Sha256: 8db8aedd0592f3ce1c3137d2c72e52d462134845db9a8a85ef30e2c17e71fbf6

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

require 'test_helper'

class ServerAdaptersVerisignTest < Test::Unit::TestCase

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

  def test_query
    response = "No match for DOMAIN.FOO."
    expected = response
    @server.expects(:ask_the_socket).with("=domain.foo", "whois.foo", 43).returns(response)
    assert_equal expected,
                 @server.query("domain.foo").to_s
    assert_equal [Whois::Answer::Part.new(response, "whois.foo")],
                 @server.buffer
  end

  def test_query_with_referral
    referral = File.read(File.dirname(__FILE__) + "/../../testcases/referrals/crsnic.com.txt")
    response = "Match for DOMAIN.FOO."
    expected = referral + "\n" + response
    @server.expects(:ask_the_socket).with("=domain.foo", "whois.foo", 43).returns(referral)
    @server.expects(:ask_the_socket).with("domain.foo", "whois.tucows.com", 43).returns(response)
    assert_equal expected,
                 @server.query("domain.foo").to_s
    assert_equal [Whois::Answer::Part.new(referral, "whois.foo"), Whois::Answer::Part.new(response, "whois.tucows.com")],
                 @server.buffer
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
whois-0.8.0 test/server/adapters/verisign_test.rb