Commit bbe7e5ec02fd896018369be7257d106a9e60b6ff
1 parent
53e9b32e
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
new functional tests added
Showing
1 changed file
with
10 additions
and
10 deletions
Show diff stats
plugins/virtuoso/test/unit/dspace_harvest_test.rb
@@ -7,7 +7,7 @@ class DspaceHarvestTest < ActiveSupport::TestCase | @@ -7,7 +7,7 @@ class DspaceHarvestTest < ActiveSupport::TestCase | ||
7 | end | 7 | end |
8 | 8 | ||
9 | attr_reader :environment | 9 | attr_reader :environment |
10 | - | 10 | + |
11 | def mock_settings | 11 | def mock_settings |
12 | { :virtuoso_uri=>"http://virtuoso.noosfero.com", | 12 | { :virtuoso_uri=>"http://virtuoso.noosfero.com", |
13 | :virtuoso_username=>"username", | 13 | :virtuoso_username=>"username", |
@@ -20,44 +20,44 @@ class DspaceHarvestTest < ActiveSupport::TestCase | @@ -20,44 +20,44 @@ class DspaceHarvestTest < ActiveSupport::TestCase | ||
20 | {"dspace_uri"=>"http://dspace3.noosfero.com"} | 20 | {"dspace_uri"=>"http://dspace3.noosfero.com"} |
21 | ] | 21 | ] |
22 | } | 22 | } |
23 | - end | 23 | + end |
24 | 24 | ||
25 | should 'create delayed job when start' do | 25 | should 'create delayed job when start' do |
26 | - harvest = VirtuosoPlugin::DspaceHarvest.new(environment) | 26 | + harvest = VirtuosoPlugin::DspaceHarvest.new(environment, "http://dspace1.noosfero.com") |
27 | assert !harvest.find_job.present? | 27 | assert !harvest.find_job.present? |
28 | harvest.start | 28 | harvest.start |
29 | assert harvest.find_job.present? | 29 | assert harvest.find_job.present? |
30 | end | 30 | end |
31 | 31 | ||
32 | should 'not duplicate harvest job' do | 32 | should 'not duplicate harvest job' do |
33 | - harvest = VirtuosoPlugin::DspaceHarvest.new(environment) | 33 | + harvest = VirtuosoPlugin::DspaceHarvest.new(environment, "http://dspace1.noosfero.com") |
34 | assert_difference "harvest.find_job.count", 1 do | 34 | assert_difference "harvest.find_job.count", 1 do |
35 | 5.times { harvest.start } | 35 | 5.times { harvest.start } |
36 | end | 36 | end |
37 | end | 37 | end |
38 | - | 38 | + |
39 | should 'harvest all dspaces from start' do | 39 | should 'harvest all dspaces from start' do |
40 | VirtuosoPlugin::DspaceHarvest.harvest_all(environment, true) | 40 | VirtuosoPlugin::DspaceHarvest.harvest_all(environment, true) |
41 | end | 41 | end |
42 | - | 42 | + |
43 | should 'try to harvest all dspaces from start without any setting' do | 43 | should 'try to harvest all dspaces from start without any setting' do |
44 | VirtuosoPlugin::DspaceHarvest.harvest_all(environment, true) | 44 | VirtuosoPlugin::DspaceHarvest.harvest_all(environment, true) |
45 | end | 45 | end |
46 | - | 46 | + |
47 | should 'try to harvest all dspaces from start with mock configuration' do | 47 | should 'try to harvest all dspaces from start with mock configuration' do |
48 | @settings = Noosfero::Plugin::Settings.new(environment, VirtuosoPlugin, mock_settings) | 48 | @settings = Noosfero::Plugin::Settings.new(environment, VirtuosoPlugin, mock_settings) |
49 | @settings.save! | 49 | @settings.save! |
50 | VirtuosoPlugin::DspaceHarvest.harvest_all(environment, true) | 50 | VirtuosoPlugin::DspaceHarvest.harvest_all(environment, true) |
51 | end | 51 | end |
52 | - | 52 | + |
53 | should 'try to harvest all dspaces without any setting' do | 53 | should 'try to harvest all dspaces without any setting' do |
54 | VirtuosoPlugin::DspaceHarvest.harvest_all(environment, false) | 54 | VirtuosoPlugin::DspaceHarvest.harvest_all(environment, false) |
55 | end | 55 | end |
56 | - | 56 | + |
57 | should 'try to harvest all dspaces with mock configuration' do | 57 | should 'try to harvest all dspaces with mock configuration' do |
58 | @settings = Noosfero::Plugin::Settings.new(environment, VirtuosoPlugin, mock_settings) | 58 | @settings = Noosfero::Plugin::Settings.new(environment, VirtuosoPlugin, mock_settings) |
59 | @settings.save! | 59 | @settings.save! |
60 | VirtuosoPlugin::DspaceHarvest.harvest_all(environment, false) | 60 | VirtuosoPlugin::DspaceHarvest.harvest_all(environment, false) |
61 | - end | 61 | + end |
62 | 62 | ||
63 | end | 63 | end |