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,7 +8,6 @@ class VirtuosoPluginAdminControllerTest < ActionController::TestCase | ||
| 8 | @environment = Environment.default | 8 | @environment = Environment.default |
| 9 | @profile = create_user('profile').person | 9 | @profile = create_user('profile').person |
| 10 | login_as(@profile.identifier) | 10 | login_as(@profile.identifier) |
| 11 | - post :index, :settings => mock_settings | ||
| 12 | end | 11 | end |
| 13 | 12 | ||
| 14 | def mock_settings | 13 | def mock_settings |
| @@ -26,6 +25,7 @@ class VirtuosoPluginAdminControllerTest < ActionController::TestCase | @@ -26,6 +25,7 @@ class VirtuosoPluginAdminControllerTest < ActionController::TestCase | ||
| 26 | end | 25 | end |
| 27 | 26 | ||
| 28 | should 'save virtuoso plugin settings' do | 27 | should 'save virtuoso plugin settings' do |
| 28 | + post :index, :settings => mock_settings | ||
| 29 | @settings = Noosfero::Plugin::Settings.new(environment.reload, VirtuosoPlugin) | 29 | @settings = Noosfero::Plugin::Settings.new(environment.reload, VirtuosoPlugin) |
| 30 | assert_equal 'http://virtuoso.noosfero.com', @settings.settings[:virtuoso_uri] | 30 | assert_equal 'http://virtuoso.noosfero.com', @settings.settings[:virtuoso_uri] |
| 31 | assert_equal 'username', @settings.settings[:virtuoso_username] | 31 | assert_equal 'username', @settings.settings[:virtuoso_username] |
| @@ -38,28 +38,33 @@ class VirtuosoPluginAdminControllerTest < ActionController::TestCase | @@ -38,28 +38,33 @@ class VirtuosoPluginAdminControllerTest < ActionController::TestCase | ||
| 38 | assert_redirected_to :action => 'index' | 38 | assert_redirected_to :action => 'index' |
| 39 | end | 39 | end |
| 40 | 40 | ||
| 41 | - | ||
| 42 | should 'redirect to index after save' do | 41 | should 'redirect to index after save' do |
| 43 | post :index, :settings => mock_settings | 42 | post :index, :settings => mock_settings |
| 44 | assert_redirected_to :action => 'index' | 43 | assert_redirected_to :action => 'index' |
| 45 | end | 44 | end |
| 46 | 45 | ||
| 47 | should 'create delayed job to start harvest on force action' do | 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 | assert !harvest.find_job.present? | 49 | assert !harvest.find_job.present? |
| 50 | get :force_harvest | 50 | get :force_harvest |
| 51 | assert harvest.find_job.present? | 51 | assert harvest.find_job.present? |
| 52 | end | 52 | end |
| 53 | 53 | ||
| 54 | should 'force harvest from start' do | 54 | should 'force harvest from start' do |
| 55 | + post :index, :settings => mock_settings | ||
| 55 | get :force_harvest, :from_start => true | 56 | get :force_harvest, :from_start => true |
| 56 | - harvest = VirtuosoPlugin::DspaceHarvest.new(environment) | 57 | + harvest = VirtuosoPlugin::DspaceHarvest.new(environment, "http://dspace2.noosfero.com") |
| 57 | assert harvest.find_job.present? | 58 | assert harvest.find_job.present? |
| 58 | assert_equal nil, harvest.settings.last_harvest | 59 | assert_equal nil, harvest.settings.last_harvest |
| 59 | end | 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 | end | 68 | end |
| 64 | - | ||
| 65 | -end | ||
| 66 | \ No newline at end of file | 69 | \ No newline at end of file |
| 70 | + | ||
| 71 | +end |