Sha256: fc8446d5dcde9b1897947c0a1062c81372b4551af20b9103e1c8ba8fec38454f
Contents?: true
Size: 1.63 KB
Versions: 4
Compression:
Stored size: 1.63 KB
Contents
# tests for SFX service # Only the the simplest of tests are done so far. To do more advanced tests, # request fixtures for more cases should be created. require 'test_helper' class SfxTest < ActiveSupport::TestCase extend TestWithCassette fixtures :requests, :referents, :dispatched_services, :service_responses def setup @sfx_default = ServiceStore.instantiate_service!("SFX", nil) end def test_initialize_minimum sfx = Sfx.new({"priority"=>1, "base_url" => "http://sfx.library.example.edu/local"}) assert_equal(1, sfx.priority) end # Use VCR to provide a deterministic SFX search. # Ignore ctx_time in the URL for VCR matching purposes # TODO: Check more of the response test_with_cassette("nytimes by issn", :sfx, :match_requests_on => [:method, :uri_without_ctx_tim]) do nytimes_request = requests(:nytimes) # Clear request nytimes_request.service_responses.each do |service_response| service_response.destroy end nytimes_request.dispatched_services.reload nytimes_request.service_responses.reload assert_equal 0, nytimes_request.service_responses.count response = @sfx_default.do_request(@sfx_default.initialize_client(nytimes_request)) @sfx_default.parse_response(response, nytimes_request) nytimes_request.dispatched_services.reload nytimes_request.service_responses.reload assert_equal 10, nytimes_request.service_responses.size first_service_response = nytimes_request.service_responses.first assert_not_nil(first_service_response.view_data[:proxy], "Proxy is nil") assert(first_service_response.view_data[:proxy], "Proxy is false") end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
umlaut-3.3.1 | ./test/unit/sfx_test.rb |
umlaut-3.3.0 | ./test/unit/sfx_test.rb |
umlaut-3.2.0 | ./test/unit/sfx_test.rb |
umlaut-3.1.1 | ./test/unit/sfx_test.rb |