Commit bbe7e5ec02fd896018369be7257d106a9e60b6ff

Authored by Evandro Jr
1 parent 53e9b32e

new functional tests added

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