Commit 350d497f112e49927365f5b73ebce2ea77164926
1 parent
abeb2ebb
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
fixed functional tests
Showing
1 changed file
with
14 additions
and
9 deletions
Show diff stats
plugins/virtuoso/test/functional/virtuoso_plugin_admin_controller_test.rb
... | ... | @@ -8,7 +8,6 @@ class VirtuosoPluginAdminControllerTest < ActionController::TestCase |
8 | 8 | @environment = Environment.default |
9 | 9 | @profile = create_user('profile').person |
10 | 10 | login_as(@profile.identifier) |
11 | - post :index, :settings => mock_settings | |
12 | 11 | end |
13 | 12 | |
14 | 13 | def mock_settings |
... | ... | @@ -26,6 +25,7 @@ class VirtuosoPluginAdminControllerTest < ActionController::TestCase |
26 | 25 | end |
27 | 26 | |
28 | 27 | should 'save virtuoso plugin settings' do |
28 | + post :index, :settings => mock_settings | |
29 | 29 | @settings = Noosfero::Plugin::Settings.new(environment.reload, VirtuosoPlugin) |
30 | 30 | assert_equal 'http://virtuoso.noosfero.com', @settings.settings[:virtuoso_uri] |
31 | 31 | assert_equal 'username', @settings.settings[:virtuoso_username] |
... | ... | @@ -38,28 +38,33 @@ class VirtuosoPluginAdminControllerTest < ActionController::TestCase |
38 | 38 | assert_redirected_to :action => 'index' |
39 | 39 | end |
40 | 40 | |
41 | - | |
42 | 41 | should 'redirect to index after save' do |
43 | 42 | post :index, :settings => mock_settings |
44 | 43 | assert_redirected_to :action => 'index' |
45 | 44 | end |
46 | 45 | |
47 | 46 | should 'create delayed job to start harvest on force action' do |
48 | - harvest = VirtuosoPlugin::DspaceHarvest.new(environment) | |
47 | + post :index, :settings => mock_settings | |
48 | + harvest = VirtuosoPlugin::DspaceHarvest.new(environment, "http://dspace1.noosfero.com") | |
49 | 49 | assert !harvest.find_job.present? |
50 | 50 | get :force_harvest |
51 | 51 | assert harvest.find_job.present? |
52 | 52 | end |
53 | 53 | |
54 | 54 | should 'force harvest from start' do |
55 | + post :index, :settings => mock_settings | |
55 | 56 | get :force_harvest, :from_start => true |
56 | - harvest = VirtuosoPlugin::DspaceHarvest.new(environment) | |
57 | + harvest = VirtuosoPlugin::DspaceHarvest.new(environment, "http://dspace2.noosfero.com") | |
57 | 58 | assert harvest.find_job.present? |
58 | 59 | assert_equal nil, harvest.settings.last_harvest |
59 | 60 | end |
60 | - | |
61 | - should 'force harvest_all from start' do | |
62 | - get :force_harvest, :from_start => true | |
61 | + | |
62 | + should 'not create delayed job to start harvest on force action without settings' do | |
63 | + post :index, :settings => mock_settings | |
64 | + harvest = VirtuosoPlugin::DspaceHarvest.new(environment, "http://dspace8.noosfero.com") | |
65 | + assert !harvest.find_job.present?, "testing if no job is running" | |
66 | + get :force_harvest | |
67 | + assert !harvest.find_job.present?, "testing if no job is running again" | |
63 | 68 | end |
64 | - | |
65 | -end | |
66 | 69 | \ No newline at end of file |
70 | + | |
71 | +end | ... | ... |