Sha256: 981587da9ce1d82af95b5e31f35f9d330dd960cb67a37b84fd6e0ef22489a72e

Contents?: true

Size: 1.57 KB

Versions: 18

Compression:

Stored size: 1.57 KB

Contents

require "helper"

class TestFedoraItem < Test::Unit::TestCase
  context "given a server" do
    setup do
      @config = YAML.load_file("private/config.yml")
      @riurl = @config[:fedora][:riurl]
      @hc = HTTPClient.new()
      @server = Server.new(@config[:fedora].merge(:http_client => @hc))
      @item = Item.new(:server => @server, :uri => "info:fedora/ac:3")
    end

    should "initialize properly with a server and pid" do
      assert @item

    end

    should "initialize properly with a server config and pid" do
      assert Item.new(:server_config => @config[:fedora], :uri => "info:fedora/ac:3")
    end

    should "require a server and pid" do
      assert_raise ArgumentError do 
        Item.new(:server => @server)
      end
    end

    should "properly parse uris into pids" do
      assert_equal @item.pid, "ac:3"
      assert_equal Item.new(:server => @server, :pid => "ac:5").pid, "ac:5"

    end

    should "be able to compare" do
     
      assert_equal @item, Item.new(:server => @server, :pid => "ac:3")
      assert_equal @item, Item.new(:server => @server, :uri => "info:fedora/ac:3")
      assert_equal @item, Item.new(:server_config => @config[:fedora], :pid => "ac:3")
    end


    should "be able to make requests" do

      @server.expects(:request).with(:pid => "ac:3", :request => "RELS-EXT")

      @item.request(:request => "RELS-EXT")
    end

    should "be able to call getIndex" do
      @hc.expects(:get_content).with(@riurl + "/get/ac:3/ldpd:sdef.Core/getIndex", :profile => "raw").returns(nil)

      @item.getIndex("raw")
    end




  end

  

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
cul-fedora-1.0.3 test/test_fedora_item.rb
cul-fedora-1.0.2 test/test_fedora_item.rb
cul-fedora-1.0.1 test/test_fedora_item.rb
cul-fedora-1.0.0 test/test_fedora_item.rb
cul-fedora-0.8.6 test/test_fedora_item.rb
cul-fedora-0.8.5 test/test_fedora_item.rb
cul-fedora-0.8.4 test/test_fedora_item.rb
cul-fedora-0.8.3 test/test_fedora_item.rb
cul-fedora-0.8.2 test/test_fedora_item.rb
cul-fedora-0.8.1 test/test_fedora_item.rb
cul-fedora-0.8.0 test/test_fedora_item.rb
cul-fedora-0.7.0 test/test_fedora_item.rb
cul-fedora-0.6.0.pre test/test_fedora_item.rb
cul-fedora-0.5.2 test/test_fedora_item.rb
cul-fedora-0.5.1 test/test_fedora_item.rb
cul-fedora-0.5.0 test/test_fedora_item.rb
cul-fedora-0.3.0 test/test_fedora_item.rb
cul-fedora-0.2.2 test/test_fedora_item.rb