test/answer/parser/whois.nic.hu_test.rb in whois-1.0.6 vs test/answer/parser/whois.nic.hu_test.rb in whois-1.0.7
- old
+ new
@@ -28,10 +28,30 @@
@klass.new(load_part('/in_progress.txt')).disclaimer
assert_equal expected,
@klass.new(load_part('/registered.txt')).disclaimer
end
+
+ def test_domain
+ assert_equal nil,
+ @klass.new(load_part('/available.txt')).domain
+ assert_equal 'ezitvps.hu',
+ @klass.new(load_part('/in_progress.txt')).domain
+ assert_equal 'google.hu',
+ @klass.new(load_part('/registered.txt')).domain
+ end
+
+ def test_domain_id
+ assert_equal nil,
+ @klass.new(load_part('/available.txt')).domain_id
+ assert_equal nil,
+ @klass.new(load_part('/in_progress.txt')).domain_id
+ assert_equal '0000219547',
+ @klass.new(load_part('/registered.txt')).domain_id
+ end
+
+
def test_status
assert_equal :available,
@klass.new(load_part('/available.txt')).status
assert_equal :in_progress,
@klass.new(load_part('/in_progress.txt')).status
@@ -49,48 +69,11 @@
assert !@klass.new(load_part('/available.txt')).registered?
assert !@klass.new(load_part('/in_progress.txt')).registered?
assert @klass.new(load_part('/registered.txt')).registered?
end
- def test_domain
- assert_equal nil,
- @klass.new(load_part('/available.txt')).domain
- assert_equal 'ezitvps.hu',
- @klass.new(load_part('/in_progress.txt')).domain
- assert_equal 'google.hu',
- @klass.new(load_part('/registered.txt')).domain
- end
- def test_id
- assert_equal nil,
- @klass.new(load_part('/available.txt')).domain_id
- assert_equal nil,
- @klass.new(load_part('/in_progress.txt')).domain_id
- assert_equal '0000219547',
- @klass.new(load_part('/registered.txt')).domain_id
- end
-
- def test_registrant_with_registered
- registrant = @klass.new(load_part('/registered.txt')).registrant
- assert_instance_of Whois::Answer::Contact, registrant
- assert_equal 'Google, Inc.', registrant.name
- assert_equal 'Google, Inc.', registrant.organization
- assert_equal 'Amphitheatre Pkwy 1600.', registrant.address
- assert_equal 'CA-94043', registrant.zip
- assert_equal 'Mountain View', registrant.city
- assert_equal 'US', registrant.country_code
- assert_equal '+1 650 253 0000', registrant.phone
- assert_equal '+1 650 253 0001', registrant.fax
- end
-
- def test_registrant_with_unregistered
- assert_equal nil,
- @klass.new(load_part('/available.txt')).registrant
- assert_equal nil,
- @klass.new(load_part('/in_progress.txt')).registrant
- end
-
def test_created_on
assert_equal nil,
@klass.new(load_part('/available.txt')).created_on
assert_equal nil,
@klass.new(load_part('/in_progress.txt')).created_on
@@ -112,10 +95,86 @@
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/available.txt')).expires_on }
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/in_progress.txt')).expires_on }
end
+ def test_registrar_with_registered
+ registrar = @klass.new(load_part('/registered.txt')).registrar
+ assert_instance_of Whois::Answer::Registrar, registrar
+ assert_equal '1960108002', registrar.id
+ assert_equal '3C Kft. (Registrar)', registrar.name
+ assert_equal '3C Ltd.', registrar.organization
+ end
+
+ def test_registrar_with_unregistered
+ assert_equal nil,
+ @klass.new(load_part('/available.txt')).registrar
+ assert_equal nil,
+ @klass.new(load_part('/in_progress.txt')).registrar
+ end
+
+
+ def test_registrant_with_registered
+ parser = @klass.new(load_part('/registered.txt'))
+ result = parser.registrant
+ assert_instance_of Whois::Answer::Contact, result
+ assert_equal result, parser.registrant
+ assert_equal result, parser.instance_eval { @registrant }
+ end
+
+ def test_registrant_with_unregistered
+ parser = @klass.new(load_part('/available.txt'))
+ result = nil
+ assert_equal result, parser.registrant
+ assert_equal result, parser.instance_eval { @registrant }
+
+ parser = @klass.new(load_part('/in_progress.txt'))
+ result = nil
+ assert_equal result, parser.registrant
+ assert_equal result, parser.instance_eval { @registrant }
+ end
+
+ def test_registrant_as_company
+ parser = @klass.new(load_part('/property_registrant_as_company.txt'))
+ result = parser.registrant
+
+ assert_instance_of Whois::Answer::Contact, result
+ assert_equal 'Google, Inc.', result.name
+ assert_equal 'Google, Inc.', result.organization
+ assert_equal 'Amphitheatre Pkwy 1600.', result.address
+ assert_equal 'CA-94043', result.zip
+ assert_equal 'Mountain View', result.city
+ assert_equal 'US', result.country_code
+ assert_equal '+1 650 253 0000', result.phone
+ assert_equal '+1 650 253 0001', result.fax
+ end
+
+ def test_registrant_as_private_person
+ parser = @klass.new(load_part('/property_registrant_as_private_person.txt'))
+ result = parser.registrant
+
+ assert_instance_of Whois::Answer::Contact, result
+ assert_match /Buruzs/, result.name # UTF-8 hack
+ assert_equal nil, result.organization
+ assert_equal nil, result.address
+ assert_equal nil, result.zip
+ assert_equal nil, result.city
+ assert_equal nil, result.country_code
+ assert_equal nil, result.phone
+ assert_equal nil, result.fax
+ end
+
+ def test_registrant_without_address
+ parser = @klass.new(load_part('/property_registrant_without_address.txt'))
+ result = parser.registrant
+
+ assert_equal nil, result.address
+ assert_equal nil, result.zip
+ assert_equal nil, result.city
+ assert_equal nil, result.country_code
+ end
+
def test_admin_with_registered
admin = @klass.new(load_part('/registered.txt')).admin
assert_instance_of Whois::Answer::Contact, admin
assert_equal '2000466366', admin.id
assert_equal '3C Kft. (Registrar)', admin.name
@@ -153,25 +212,11 @@
@klass.new(load_part('/available.txt')).technical
assert_equal nil,
@klass.new(load_part('/in_progress.txt')).technical
end
- def test_registrar_with_registered
- registrar = @klass.new(load_part('/registered.txt')).registrar
- assert_instance_of Whois::Answer::Registrar, registrar
- assert_equal '1960108002', registrar.id
- assert_equal '3C Kft. (Registrar)', registrar.name
- assert_equal '3C Ltd.', registrar.organization
- end
- def test_registrar_with_unregistered
- assert_equal nil,
- @klass.new(load_part('/available.txt')).registrar
- assert_equal nil,
- @klass.new(load_part('/in_progress.txt')).registrar
- end
-
def test_nameserver
parser = @klass.new(load_part('/registered.txt'))
expected = %w( ns1.google.com ns4.google.com ns3.google.com ns2.google.com )
assert_equal expected, parser.nameservers
assert_equal expected, parser.instance_eval { @nameservers }
@@ -184,9 +229,10 @@
parser = @klass.new(load_part('/in_progress.txt'))
expected = %w()
assert_equal expected, parser.nameservers
assert_equal expected, parser.instance_eval { @nameservers }
end
+
def test_zone_contact_with_registered
zone_contact = @klass.new(load_part('/registered.txt')).zone_contact
assert_instance_of Whois::Answer::Contact, zone_contact
assert_equal '2000578125', zone_contact.id
\ No newline at end of file