Commit 96050174f043a3b387f441ab956b1afcd8ed02ec

Authored by Evandro Jr
1 parent 1023c3a5

test fixed

plugins/virtuoso/test/unit/dspace_harvest_test.rb
1 -require File.dirname(__FILE__) + '/../test_helper' 1 +require File.dirname(__FILE__) + '/../test_helper.rb'
2 2
3 class DspaceHarvestTest < ActiveSupport::TestCase 3 class DspaceHarvestTest < ActiveSupport::TestCase
4 4
@@ -81,24 +81,24 @@ class DspaceHarvestTest &lt; ActiveSupport::TestCase @@ -81,24 +81,24 @@ class DspaceHarvestTest &lt; ActiveSupport::TestCase
81 settings.save! 81 settings.save!
82 VirtuosoPlugin::DspaceHarvest.harvest_all(environment, false) 82 VirtuosoPlugin::DspaceHarvest.harvest_all(environment, false)
83 end 83 end
84 -  
85 - should 'update last_harvest after harvert from start' do 84 +
  85 + should 'update last_harvest after harvert' do
86 settings = 86 settings =
87 - { :virtuoso_uri=>"http://virtuoso.set_at_etc_hosts",  
88 - :virtuoso_username=>"dba",  
89 - :virtuoso_password=>"dba",  
90 - :virtuoso_readonly_username=>"dba",  
91 - :virtuoso_readonly_password=>"dba", 87 + { :virtuoso_uri=>"http://virtuoso",
  88 + :virtuoso_username=>"username",
  89 + :virtuoso_password=>"password",
  90 + :virtuoso_readonly_username=>"username",
  91 + :virtuoso_readonly_password=>"password",
92 :dspace_servers=>[ 92 :dspace_servers=>[
93 - {"dspace_uri"=>"http://dspace.set_at_etc_hosts","last_harvest" => Time.now.utc } 93 + {"dspace_uri"=>"http://dspace","last_harvest" => Time.now.utc }
94 ] 94 ]
95 - } 95 + }
96 @settings = Noosfero::Plugin::Settings.new(environment, VirtuosoPlugin, settings) 96 @settings = Noosfero::Plugin::Settings.new(environment, VirtuosoPlugin, settings)
97 - harvest = VirtuosoPlugin::DspaceHarvest.new(environment, {"dspace_uri"=>"http://virtuoso.set_at_etc_hosts" })  
98 - puts "last_harvest before #{harvest.last_harvest}"  
99 - harvest.run  
100 - puts "last_harvest after #{harvest.last_harvest}"  
101 - asser 97 + harvest = VirtuosoPlugin::DspaceHarvest.new(environment, {"dspace_uri"=>"http://virtuoso" })
  98 + dspace_client = mock
  99 + harvest.expects(:dspace_client).returns(dspace_client)
  100 + dspace_client.expects(:list_records).returns([])
  101 + assert_not_equal harvest.last_harvest, nil
102 end 102 end
103 103
104 -end 104 -end
  105 +end
105 \ No newline at end of file 106 \ No newline at end of file