Sha256: 2a26c50fda350809c405bd1c2199c8916a7e1e980e2073e54712dce78b68f27a

Contents?: true

Size: 913 Bytes

Versions: 1

Compression:

Stored size: 913 Bytes

Contents

require 'test_helper'

class ServerAdaptersPirTest < Test::Unit::TestCase
  include Whois

  def setup
    @definition = [:tld, ".foo", "whois.foo", {}]
    @klass = Server::Adapters::Pir
    @server = @klass.new(*@definition)
  end

  def test_query
    expected = "No match for DOMAIN.FOO."
    @server.expects(:ask_the_socket).with("FULL domain.foo", "whois.publicinterestregistry.net", 43).returns(expected)
    assert_equal expected, @server.query("domain.foo")
  end

  def test_query_with_referral
    response = File.read(File.dirname(__FILE__) + "/../testcases/referrals/pir.org.txt")
    expected = "Match for DOMAIN.FOO."
    @server.expects(:ask_the_socket).with("FULL domain.foo", "whois.publicinterestregistry.net", 43).returns(response)
    @server.expects(:ask_the_socket).with("domain.foo", "whois.iana.org", 43).returns(expected)
    assert_equal expected, @server.query("domain.foo")
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
whois-0.5.0 test/adapters/pir_test.rb