Sha256: 5030e9a7bc668ff2f023cdae003fc9849b100d5824d3040911e104015aed5baa

Contents?: true

Size: 1.41 KB

Versions: 7

Compression:

Stored size: 1.41 KB

Contents

# tests for internet archive 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 InternetArchiveTest < ActiveSupport::TestCase  
  extend TestWithCassette
  fixtures :requests, :referents, :referent_values
  
  def setup    
    @ia_default = ServiceStore.instantiate_service!("InternetArchive", nil)
  end

  test_with_cassette("momo by title author", :internet_archive) do
    request = requests(:momo)
    # Clear out the current responses.
    request.service_responses.each do |service_response|
      service_response.destroy
    end
    @ia_default.handle(request)
    request.referent.referent_values.reset
    request.dispatched_services.reset
    request.service_responses.reset
    fulltexts = request.get_service_type('fulltext')
    assert((not fulltexts.empty?), "IA didn't return any fulltext")
    assert_equal(1, fulltexts.length, "IA returned an unexpected number of fulltexts")
    fulltext = fulltexts.first
    assert_equal("http://archive.org/details/MomoOvveroLarcanaStoriaDeiLadriDiTempoEDellaBambinaCheRestitu", 
      fulltext.url, "IA Service constructed an unexpected URL")
    view_data = fulltext.view_data
    assert((not view_data.nil?), "IA full text view data is nil")
    assert_equal("the Internet Archive: Open Source Book", view_data[:display_text], "IA display text is unexpected")
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
umlaut-3.3.1 ./test/unit/internet_archive_test.rb
umlaut-3.3.0 ./test/unit/internet_archive_test.rb
umlaut-3.2.0 ./test/unit/internet_archive_test.rb
umlaut-3.1.1 ./test/unit/internet_archive_test.rb
umlaut-3.1.0 ./test/unit/internet_archive_test.rb
umlaut-3.1.0.pre2 ./test/unit/internet_archive_test.rb
umlaut-3.1.0.pre1 ./test/unit/internet_archive_test.rb