nominet-epp 0.0.12 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +24 -0
- data/.travis.yml +14 -0
- data/.yardopts +8 -2
- data/Gemfile +22 -0
- data/Gemfile.lock +64 -0
- data/HISTORY.md +78 -0
- data/LICENSE +1 -1
- data/README.md +23 -0
- data/Rakefile +2 -37
- data/gemfiles/Gemfile.ruby18 +13 -0
- data/lib/nominet-epp/client.rb +364 -0
- data/lib/nominet-epp/notification.rb +346 -0
- data/lib/nominet-epp/operations.rb +2 -7
- data/lib/nominet-epp/request.rb +165 -0
- data/lib/nominet-epp/requests/contact/check.rb +9 -0
- data/lib/nominet-epp/requests/contact/create.rb +60 -0
- data/lib/nominet-epp/requests/contact/delete.rb +9 -0
- data/lib/nominet-epp/requests/contact/info.rb +9 -0
- data/lib/nominet-epp/requests/contact/release.rb +33 -0
- data/lib/nominet-epp/requests/contact/update.rb +63 -0
- data/lib/nominet-epp/requests/custom/handshake.rb +36 -0
- data/lib/nominet-epp/requests/custom/list.rb +38 -0
- data/lib/nominet-epp/requests/custom/tag_list.rb +25 -0
- data/lib/nominet-epp/requests/domain/check.rb +98 -0
- data/lib/nominet-epp/requests/domain/create.rb +97 -0
- data/lib/nominet-epp/requests/domain/delete.rb +9 -0
- data/lib/nominet-epp/requests/domain/info.rb +9 -0
- data/lib/nominet-epp/requests/domain/release.rb +33 -0
- data/lib/nominet-epp/requests/domain/renew.rb +9 -0
- data/lib/nominet-epp/requests/domain/unrenew.rb +33 -0
- data/lib/nominet-epp/requests/domain/update.rb +134 -0
- data/lib/nominet-epp/requests/host/check.rb +9 -0
- data/lib/nominet-epp/requests/host/create.rb +9 -0
- data/lib/nominet-epp/requests/host/delete.rb +9 -0
- data/lib/nominet-epp/requests/host/info.rb +9 -0
- data/lib/nominet-epp/requests/host/update.rb +9 -0
- data/lib/nominet-epp/responses/contact/check_response.rb +10 -0
- data/lib/nominet-epp/responses/contact/create_response.rb +14 -0
- data/lib/nominet-epp/responses/contact/delete_response.rb +10 -0
- data/lib/nominet-epp/responses/contact/info_response.rb +89 -0
- data/lib/nominet-epp/responses/contact/release_response.rb +10 -0
- data/lib/nominet-epp/responses/contact/update_response.rb +10 -0
- data/lib/nominet-epp/responses/custom/handshake_response.rb +33 -0
- data/lib/nominet-epp/responses/custom/list_response.rb +29 -0
- data/lib/nominet-epp/responses/custom/tag_list_response.rb +37 -0
- data/lib/nominet-epp/responses/domain/check_response.rb +40 -0
- data/lib/nominet-epp/responses/domain/create_response.rb +10 -0
- data/lib/nominet-epp/responses/domain/delete_response.rb +10 -0
- data/lib/nominet-epp/responses/domain/info_response.rb +128 -0
- data/lib/nominet-epp/responses/domain/release_response.rb +10 -0
- data/lib/nominet-epp/responses/domain/renew_response.rb +10 -0
- data/lib/nominet-epp/responses/domain/unrenew_response.rb +26 -0
- data/lib/nominet-epp/responses/domain/update_response.rb +10 -0
- data/lib/nominet-epp/responses/host/check_response.rb +10 -0
- data/lib/nominet-epp/responses/host/create_response.rb +14 -0
- data/lib/nominet-epp/responses/host/delete_response.rb +10 -0
- data/lib/nominet-epp/responses/host/info_response.rb +14 -0
- data/lib/nominet-epp/responses/host/update_response.rb +10 -0
- data/lib/nominet-epp/responses/response.rb +27 -0
- data/lib/nominet-epp/version.rb +4 -0
- data/lib/nominet-epp.rb +60 -161
- data/nominet-epp.gemspec +15 -65
- data/test/helper.rb +57 -0
- data/test/notifications/test_contact_deleted_notification.rb +23 -0
- data/test/notifications/test_domain_cancelled_notification.rb +23 -0
- data/test/notifications/test_domains_released_notification.rb +34 -0
- data/test/notifications/test_domains_suspended_notification.rb +30 -0
- data/test/notifications/test_handshake_rejected_notification.rb +34 -0
- data/test/notifications/test_registrant_transfer_notification.rb +78 -0
- data/test/notifications/test_registrar_change_notification.rb +119 -0
- data/test/requests/contact/test_contact_check_request.rb +25 -0
- data/test/requests/contact/test_contact_create_request.rb +104 -0
- data/test/requests/contact/test_contact_delete_request.rb +20 -0
- data/test/requests/contact/test_contact_info_request.rb +20 -0
- data/test/requests/contact/test_contact_release_request.rb +29 -0
- data/test/requests/contact/test_contact_update_request.rb +111 -0
- data/test/requests/custom/test_custom_handshake_request.rb +42 -0
- data/test/requests/custom/test_custom_list_request.rb +44 -0
- data/test/requests/custom/test_custom_tag_list_request.rb +21 -0
- data/test/requests/domain/test_domain_check_request.rb +140 -0
- data/test/requests/domain/test_domain_create_request.rb +136 -0
- data/test/requests/domain/test_domain_delete_request.rb +20 -0
- data/test/requests/domain/test_domain_info_request.rb +20 -0
- data/test/requests/domain/test_domain_release_request.rb +29 -0
- data/test/requests/domain/test_domain_renew_request.rb +15 -0
- data/test/requests/domain/test_domain_unrenew_request.rb +32 -0
- data/test/requests/domain/test_domain_update_request.rb +163 -0
- data/test/requests/host/test_host_check_request.rb +25 -0
- data/test/requests/host/test_host_create_request.rb +33 -0
- data/test/requests/host/test_host_delete_request.rb +20 -0
- data/test/requests/host/test_host_info_request.rb +20 -0
- data/test/requests/host/test_host_update_request.rb +55 -0
- data/test/responses/contact/test_contact_check_response.rb +28 -0
- data/test/responses/contact/test_contact_create_response.rb +28 -0
- data/test/responses/contact/test_contact_delete_response.rb +18 -0
- data/test/responses/contact/test_contact_info_response.rb +79 -0
- data/test/responses/contact/test_contact_release_response.rb +18 -0
- data/test/responses/contact/test_contact_update_response.rb +18 -0
- data/test/responses/custom/test_custom_handshake_response.rb +27 -0
- data/test/responses/custom/test_custom_list_response.rb +44 -0
- data/test/responses/custom/test_custom_tag_list_response.rb +43 -0
- data/test/responses/domain/test_domain_check_response.rb +56 -0
- data/test/responses/domain/test_domain_create_response.rb +34 -0
- data/test/responses/domain/test_domain_delete_response.rb +18 -0
- data/test/responses/domain/test_domain_info_response.rb +76 -0
- data/test/responses/domain/test_domain_release_response.rb +18 -0
- data/test/responses/domain/test_domain_renew_response.rb +27 -0
- data/test/responses/domain/test_domain_unrenew_response.rb +32 -0
- data/test/responses/domain/test_domain_update_response.rb +18 -0
- data/test/responses/host/test_host_check_response.rb +28 -0
- data/test/responses/host/test_host_create_response.rb +28 -0
- data/test/responses/host/test_host_delete_response.rb +18 -0
- data/test/responses/host/test_host_info_response.rb +28 -0
- data/test/responses/host/test_host_update_response.rb +18 -0
- data/test/support/responses/contact/check.xml +23 -0
- data/test/support/responses/contact/create.xml +23 -0
- data/test/support/responses/contact/delete.xml +12 -0
- data/test/support/responses/contact/info.xml +46 -0
- data/test/support/responses/contact/release.xml +12 -0
- data/test/support/responses/contact/update.xml +12 -0
- data/test/support/responses/custom/handshake.xml +24 -0
- data/test/support/responses/custom/list.xml +28 -0
- data/test/support/responses/custom/list_empty.xml +21 -0
- data/test/support/responses/custom/tag_list.xml +28 -0
- data/test/support/responses/domain/check-direct-rights.xml +1 -0
- data/test/support/responses/domain/check.xml +25 -0
- data/test/support/responses/domain/create.xml +24 -0
- data/test/support/responses/domain/delete.xml +12 -0
- data/test/support/responses/domain/info.xml +45 -0
- data/test/support/responses/domain/release.xml +12 -0
- data/test/support/responses/domain/renew.xml +24 -0
- data/test/support/responses/domain/unrenew.xml +26 -0
- data/test/support/responses/domain/update.xml +12 -0
- data/test/support/responses/host/check.xml +23 -0
- data/test/support/responses/host/create.xml +18 -0
- data/test/support/responses/host/delete.xml +12 -0
- data/test/support/responses/host/info.xml +25 -0
- data/test/support/responses/host/update.xml +12 -0
- data/test/support/responses/notifications/abuse-feed.xml +31 -0
- data/test/support/responses/notifications/account-change.xml +39 -0
- data/test/support/responses/notifications/contact-deleted.xml +22 -0
- data/test/support/responses/notifications/data-quality.xml +53 -0
- data/test/support/responses/notifications/domain-cancelled.xml +22 -0
- data/test/support/responses/notifications/domains-released.xml +31 -0
- data/test/support/responses/notifications/domains-suspended.xml +26 -0
- data/test/support/responses/notifications/handshake-rejected.xml +31 -0
- data/test/support/responses/notifications/handshake-request.xml +65 -0
- data/test/support/responses/notifications/hosts-cancelled.xml +28 -0
- data/test/support/responses/notifications/referral-accepted.xml +23 -0
- data/test/support/responses/notifications/referral-rejected.xml +22 -0
- data/test/support/responses/notifications/registrant-transfer.xml +54 -0
- data/test/support/responses/notifications/registrar-change.xml +67 -0
- data/test/support/schemas/README +12 -0
- data/test/support/schemas/RELEASENOTES +54 -0
- data/test/support/schemas/contact-1.0.xsd +387 -0
- data/test/support/schemas/contact-nom-ext-1.0.xsd +144 -0
- data/test/support/schemas/domain-1.0.xsd +432 -0
- data/test/support/schemas/domain-nom-ext-1.2.xsd +215 -0
- data/test/support/schemas/epp-1.0.xsd +403 -0
- data/test/support/schemas/eppcom-1.0.xsd +93 -0
- data/test/support/schemas/host-1.0.xsd +240 -0
- data/test/support/schemas/nom-abuse-feed-1.0.xsd +46 -0
- data/test/support/schemas/nom-direct-rights-1.0.xsd +48 -0
- data/test/support/schemas/nom-root-std-1.0.7.xsd +47 -0
- data/test/support/schemas/nom-root-tag-1.0.xsd +31 -0
- data/test/support/schemas/nom-tag-1.0.xsd +71 -0
- data/test/support/schemas/secDNS-1.1.xsd +127 -0
- data/test/support/schemas/std-contact-id-1.0.xsd +35 -0
- data/test/support/schemas/std-fork-1.0.xsd +31 -0
- data/test/support/schemas/std-handshake-1.0.xsd +61 -0
- data/test/support/schemas/std-list-1.0.xsd +55 -0
- data/test/support/schemas/std-locks-1.0.xsd +53 -0
- data/test/support/schemas/std-notifications-1.2.xsd +197 -0
- data/test/support/schemas/std-release-1.0.xsd +39 -0
- data/test/support/schemas/std-unrenew-1.0.xsd +26 -0
- data/test/support/schemas/std-warning-1.1.xsd +145 -0
- data/test/test_nominet-epp.rb +3 -3
- metadata +324 -104
- data/History.rdoc +0 -78
- data/README.rdoc +0 -23
- data/VERSION +0 -1
- data/lib/nominet-epp/operations/check.rb +0 -39
- data/lib/nominet-epp/operations/create.rb +0 -138
- data/lib/nominet-epp/operations/delete.rb +0 -20
- data/lib/nominet-epp/operations/fork.rb +0 -53
- data/lib/nominet-epp/operations/hello.rb +0 -11
- data/lib/nominet-epp/operations/info.rb +0 -93
- data/lib/nominet-epp/operations/list.rb +0 -83
- data/lib/nominet-epp/operations/lock.rb +0 -56
- data/lib/nominet-epp/operations/merge.rb +0 -41
- data/lib/nominet-epp/operations/poll.rb +0 -64
- data/lib/nominet-epp/operations/renew.rb +0 -40
- data/lib/nominet-epp/operations/transfer.rb +0 -84
- data/lib/nominet-epp/operations/unlock.rb +0 -56
- data/lib/nominet-epp/operations/unrenew.rb +0 -36
- data/lib/nominet-epp/operations/update.rb +0 -176
@@ -0,0 +1,119 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestNominetRegistrarChangeNotification < Test::Unit::TestCase
|
4
|
+
context 'NominetEPP::Notifications::RegistrarChange' do
|
5
|
+
setup do
|
6
|
+
@notification =
|
7
|
+
NominetEPP::Notification.new(
|
8
|
+
load_response('notifications/registrar-change'))
|
9
|
+
end
|
10
|
+
subject { @notification }
|
11
|
+
|
12
|
+
should 'have type' do
|
13
|
+
assert_equal :registrar_change, subject.type
|
14
|
+
end
|
15
|
+
|
16
|
+
should 'have originator' do
|
17
|
+
assert_equal 'p@automaton-example.org.uk', subject.originator
|
18
|
+
end
|
19
|
+
should 'have registrar tag' do
|
20
|
+
assert_equal 'EXAMPLE', subject.registrar_tag
|
21
|
+
end
|
22
|
+
context '#domains' do
|
23
|
+
subject { @notification.domains }
|
24
|
+
context '[0]' do
|
25
|
+
subject { @notification.domains[0] }
|
26
|
+
should 'have name' do
|
27
|
+
assert_equal 'auto-example1.co.uk', subject.name
|
28
|
+
end
|
29
|
+
should 'have roid' do
|
30
|
+
assert_equal '65876854-UK', subject.roid
|
31
|
+
end
|
32
|
+
should 'have nameservers' do
|
33
|
+
expected = %w(ns0.epp-example.co.uk ns1.epp-example.co.uk)
|
34
|
+
assert_equal expected, subject.nameservers
|
35
|
+
end
|
36
|
+
should 'have client id' do
|
37
|
+
assert_equal 'EXAMPLE-TAG', subject.client_id
|
38
|
+
end
|
39
|
+
should 'have creator id' do
|
40
|
+
assert_equal 'example@epp-exam', subject.creator_id
|
41
|
+
end
|
42
|
+
should 'have created date' do
|
43
|
+
expected = Time.mktime(2005,6,3,12)
|
44
|
+
assert_equal expected, subject.created_date
|
45
|
+
end
|
46
|
+
should 'have expiration date' do
|
47
|
+
expected = Time.mktime(2007,6,3,12)
|
48
|
+
assert_equal expected, subject.expiration_date
|
49
|
+
end
|
50
|
+
end
|
51
|
+
context '[1]' do
|
52
|
+
subject { @notification.domains[1] }
|
53
|
+
should 'have name' do
|
54
|
+
assert_equal 'epp-example2.co.uk', subject.name
|
55
|
+
end
|
56
|
+
should 'have roid' do
|
57
|
+
assert_equal '568957896-UK', subject.roid
|
58
|
+
end
|
59
|
+
should 'have client id' do
|
60
|
+
assert_equal 'EXAMPLE-TAG', subject.client_id
|
61
|
+
end
|
62
|
+
should 'have creator id' do
|
63
|
+
assert_equal 'example@epp-exa', subject.creator_id
|
64
|
+
end
|
65
|
+
should 'have created date' do
|
66
|
+
expected = Time.mktime(2005,6,3,12)
|
67
|
+
assert_equal expected, subject.created_date
|
68
|
+
end
|
69
|
+
should 'have expiration date' do
|
70
|
+
expected = Time.mktime(2007,6,3,12)
|
71
|
+
assert_equal expected, subject.expiration_date
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
context '#contact' do
|
76
|
+
subject { @notification.contact }
|
77
|
+
should 'have contact id' do
|
78
|
+
assert_equal 'ST96503FG', subject.id
|
79
|
+
end
|
80
|
+
should 'have contact roid' do
|
81
|
+
assert_equal '5876578-UK', subject.roid
|
82
|
+
end
|
83
|
+
should 'have contact postal info' do
|
84
|
+
expected = { :name => "Mr R Strant",
|
85
|
+
:org => "reg company",
|
86
|
+
:addr => {
|
87
|
+
:street => "2102 High Street",
|
88
|
+
:city => "Oxford",
|
89
|
+
:sp => "Oxon",
|
90
|
+
:pc => "OX1 1QQ",
|
91
|
+
:cc => "GB" }}
|
92
|
+
assert_equal expected, subject.postal_info
|
93
|
+
end
|
94
|
+
should 'have contact voice' do
|
95
|
+
assert_equal '+44.1865123456', subject.voice
|
96
|
+
end
|
97
|
+
should 'have contact email' do
|
98
|
+
assert_equal 'r.strant@epp-example.co.uk', subject.email
|
99
|
+
end
|
100
|
+
should 'have contact client id' do
|
101
|
+
assert_equal 'TEST', subject.client_id
|
102
|
+
end
|
103
|
+
should 'have contact creator id' do
|
104
|
+
assert_equal 'domains@epp-exam', subject.creator_id
|
105
|
+
end
|
106
|
+
should 'have contact created date' do
|
107
|
+
expected = Time.gm(1999,4,3,22,0,0)
|
108
|
+
assert_equal expected, subject.created_date
|
109
|
+
end
|
110
|
+
should 'have contact updator id' do
|
111
|
+
assert_equal 'domains@isp.com', subject.updator_id
|
112
|
+
end
|
113
|
+
should 'have contact updated date' do
|
114
|
+
expected = Time.gm(1999,12,3,9,0,0)
|
115
|
+
assert_equal expected, subject.updated_date
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestNominetContactCheckRequest < Test::Unit::TestCase
|
4
|
+
context 'NominetEPP::Contact::Check' do
|
5
|
+
setup do
|
6
|
+
@request = NominetEPP::Contact::Check.new('sh8013', 'sh8018')
|
7
|
+
@xml = prepare_request.to_xml
|
8
|
+
|
9
|
+
namespaces_from_request
|
10
|
+
end
|
11
|
+
|
12
|
+
should 'validate against schema' do
|
13
|
+
assert @xml.validate_schema(schema)
|
14
|
+
end
|
15
|
+
|
16
|
+
should 'include names' do
|
17
|
+
names = []
|
18
|
+
xpath_each('//contact:id') do |node|
|
19
|
+
names << node.content.strip
|
20
|
+
end
|
21
|
+
|
22
|
+
assert_equal %w(sh8013 sh8018), names
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestNominetContactCreateRequest < Test::Unit::TestCase
|
4
|
+
context 'NominetEPP::Contact::Create' do
|
5
|
+
context 'no extensions' do
|
6
|
+
setup do
|
7
|
+
@request = NominetEPP::Contact::Create.new('UK-4398495',
|
8
|
+
:voice => "+44.1234567890",
|
9
|
+
:email => "enoch.root@test.host",
|
10
|
+
:postal_info => {
|
11
|
+
:org => "Epiphyte",
|
12
|
+
:name => "Enoch Root",
|
13
|
+
:addr => {
|
14
|
+
:street => "1 Test Avenue",
|
15
|
+
:city => "Testington",
|
16
|
+
:sp => "Testshire",
|
17
|
+
:pc => "TE57 1NG",
|
18
|
+
:cc => "GB" } })
|
19
|
+
@xml = prepare_request.to_xml
|
20
|
+
|
21
|
+
namespaces_from_request
|
22
|
+
end
|
23
|
+
|
24
|
+
should 'validate against schema' do
|
25
|
+
assert @xml.validate_schema(schema)
|
26
|
+
end
|
27
|
+
|
28
|
+
should 'set id' do
|
29
|
+
assert_equal 'UK-4398495', xpath_find('//contact:id')
|
30
|
+
end
|
31
|
+
|
32
|
+
should 'set voice' do
|
33
|
+
assert_equal "+44.1234567890", xpath_find('//contact:voice')
|
34
|
+
end
|
35
|
+
should 'set email' do
|
36
|
+
assert_equal "enoch.root@test.host", xpath_find('//contact:email')
|
37
|
+
end
|
38
|
+
should 'set organisation' do
|
39
|
+
assert_equal "Epiphyte", xpath_find('//contact:postalInfo[@type="loc"]/contact:org')
|
40
|
+
end
|
41
|
+
should 'set name' do
|
42
|
+
assert_equal "Enoch Root", xpath_find('//contact:postalInfo[@type="loc"]/contact:name')
|
43
|
+
end
|
44
|
+
should 'set address' do
|
45
|
+
assert_equal "1 Test Avenue", xpath_find('//contact:postalInfo[@type="loc"]/contact:addr/contact:street')
|
46
|
+
assert_equal "Testington", xpath_find('//contact:postalInfo[@type="loc"]/contact:addr/contact:city')
|
47
|
+
assert_equal "Testshire", xpath_find('//contact:postalInfo[@type="loc"]/contact:addr/contact:sp')
|
48
|
+
assert_equal "TE57 1NG", xpath_find('//contact:postalInfo[@type="loc"]/contact:addr/contact:pc')
|
49
|
+
assert_equal "GB", xpath_find('//contact:postalInfo[@type="loc"]/contact:addr/contact:cc')
|
50
|
+
end
|
51
|
+
|
52
|
+
should 'not have extension element' do
|
53
|
+
assert !xpath_exists?('//epp:extension'), "should not have extension element"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
context 'nominet extensions' do
|
57
|
+
setup do
|
58
|
+
@request = NominetEPP::Contact::Create.new('UK-4398495',
|
59
|
+
:voice => "+44.1234567890",
|
60
|
+
:email => "enoch.root@test.host",
|
61
|
+
:postal_info => {
|
62
|
+
:org => "Epiphyte",
|
63
|
+
:name => "Enoch Root",
|
64
|
+
:addr => {
|
65
|
+
:street => "1 Test Avenue",
|
66
|
+
:city => "Testington",
|
67
|
+
:sp => "Testshire",
|
68
|
+
:pc => "TE57 1NG",
|
69
|
+
:cc => "GB" } },
|
70
|
+
:trad_name => "Trading name",
|
71
|
+
:type => "LTD",
|
72
|
+
:co_no => "12345678",
|
73
|
+
:opt_out => false)
|
74
|
+
@xml = prepare_request.to_xml
|
75
|
+
|
76
|
+
namespaces_from_request
|
77
|
+
end
|
78
|
+
|
79
|
+
should 'validate against schema' do
|
80
|
+
assert @xml.validate_schema(schema)
|
81
|
+
end
|
82
|
+
|
83
|
+
should 'have contact extension element' do
|
84
|
+
assert xpath_exists?('//contact-ext:create'), "should have extension create element"
|
85
|
+
end
|
86
|
+
|
87
|
+
should 'set trad-name' do
|
88
|
+
assert_equal "Trading name", xpath_find('//contact-ext:trad-name')
|
89
|
+
end
|
90
|
+
|
91
|
+
should 'set type' do
|
92
|
+
assert_equal "LTD", xpath_find('//contact-ext:type')
|
93
|
+
end
|
94
|
+
|
95
|
+
should 'set co-no' do
|
96
|
+
assert_equal "12345678", xpath_find('//contact-ext:co-no')
|
97
|
+
end
|
98
|
+
|
99
|
+
should 'set opt-out' do
|
100
|
+
assert_equal "N", xpath_find('//contact-ext:opt-out')
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestNominetContactDeleteRequest < Test::Unit::TestCase
|
4
|
+
context 'NominetEPP::Contact::Delete' do
|
5
|
+
setup do
|
6
|
+
@request = NominetEPP::Contact::Delete.new('sh8013')
|
7
|
+
@xml = prepare_request.to_xml
|
8
|
+
|
9
|
+
namespaces_from_request
|
10
|
+
end
|
11
|
+
|
12
|
+
should 'validate against schema' do
|
13
|
+
assert @xml.validate_schema(schema)
|
14
|
+
end
|
15
|
+
|
16
|
+
should 'have name' do
|
17
|
+
assert_equal 'sh8013', xpath_find('//contact:id')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestNominetContactInfoRequest < Test::Unit::TestCase
|
4
|
+
context 'NominetEPP::Contact::Info' do
|
5
|
+
setup do
|
6
|
+
@request = NominetEPP::Contact::Info.new('sh8013')
|
7
|
+
@xml = prepare_request.to_xml
|
8
|
+
|
9
|
+
namespaces_from_request
|
10
|
+
end
|
11
|
+
|
12
|
+
should 'validate against schema' do
|
13
|
+
assert @xml.validate_schema(schema)
|
14
|
+
end
|
15
|
+
|
16
|
+
should 'have name' do
|
17
|
+
assert_equal 'sh8013', xpath_find('//contact:id')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestNominetContactReleaseRequest < Test::Unit::TestCase
|
4
|
+
context 'NominetEPP::Contact::Release' do
|
5
|
+
setup do
|
6
|
+
@time = Time.now.utc
|
7
|
+
@request = NominetEPP::Contact::Release.new('sh8013', 'TESTING')
|
8
|
+
@xml = prepare_request.to_xml
|
9
|
+
|
10
|
+
namespaces_from_request
|
11
|
+
end
|
12
|
+
|
13
|
+
should 'validate against schema' do
|
14
|
+
assert @xml.validate_schema(schema)
|
15
|
+
end
|
16
|
+
|
17
|
+
should 'have release element' do
|
18
|
+
assert xpath_exists?('//r:release'), "should have release element"
|
19
|
+
end
|
20
|
+
|
21
|
+
should 'have registrant element' do
|
22
|
+
assert_equal 'sh8013', xpath_find('//r:registrant')
|
23
|
+
end
|
24
|
+
|
25
|
+
should 'have registrarTag element' do
|
26
|
+
assert_equal 'TESTING', xpath_find('//r:registrarTag')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestNominetContactUpdateRequest < Test::Unit::TestCase
|
4
|
+
context 'NominetEPP::Contact::Update' do
|
5
|
+
context 'no extensions' do
|
6
|
+
setup do
|
7
|
+
@time = Time.now.utc
|
8
|
+
@request = NominetEPP::Contact::Update.new('sh8013',
|
9
|
+
:chg => {
|
10
|
+
:voice => "+44.1234567890",
|
11
|
+
:email => "enoch.root@test.host",
|
12
|
+
:postal_info => {
|
13
|
+
:org => "Epiphyte",
|
14
|
+
:name => "Enoch Root",
|
15
|
+
:addr => {
|
16
|
+
:street => "1 Test Avenue",
|
17
|
+
:city => "Testington",
|
18
|
+
:sp => "Testshire",
|
19
|
+
:pc => "TE57 1NG",
|
20
|
+
:cc => "GB" }}})
|
21
|
+
@xml = prepare_request.to_xml
|
22
|
+
|
23
|
+
namespaces_from_request
|
24
|
+
end
|
25
|
+
|
26
|
+
should 'validate against schema' do
|
27
|
+
assert @xml.validate_schema(schema)
|
28
|
+
end
|
29
|
+
|
30
|
+
should 'have update element' do
|
31
|
+
assert xpath_exists?('//contact:update'), "should have update element"
|
32
|
+
end
|
33
|
+
|
34
|
+
should 'have name element' do
|
35
|
+
assert_equal 'sh8013', xpath_find('//contact:id')
|
36
|
+
end
|
37
|
+
|
38
|
+
should 'set voice for change' do
|
39
|
+
assert_equal "+44.1234567890", xpath_find('//contact:chg/contact:voice')
|
40
|
+
end
|
41
|
+
should 'set email for change' do
|
42
|
+
assert_equal "enoch.root@test.host", xpath_find('//contact:chg/contact:email')
|
43
|
+
end
|
44
|
+
should 'not set organisation for change' do
|
45
|
+
# assert_equal "Epiphyte", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:org')
|
46
|
+
assert !xpath_exists?('//contact:chg/contact:postalInfo[@type="loc"]/contact:org')
|
47
|
+
end
|
48
|
+
should 'set name for change' do
|
49
|
+
assert_equal "Enoch Root", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:name')
|
50
|
+
end
|
51
|
+
should 'set address for change' do
|
52
|
+
assert_equal "1 Test Avenue", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:addr/contact:street')
|
53
|
+
assert_equal "Testington", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:addr/contact:city')
|
54
|
+
assert_equal "Testshire", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:addr/contact:sp')
|
55
|
+
assert_equal "TE57 1NG", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:addr/contact:pc')
|
56
|
+
assert_equal "GB", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:addr/contact:cc')
|
57
|
+
end
|
58
|
+
|
59
|
+
should 'not have extension element' do
|
60
|
+
assert !xpath_exists?('//epp:extension'), "should not have extension element"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
context 'nominet extensions' do
|
64
|
+
setup do
|
65
|
+
@time = Time.now.utc
|
66
|
+
@request = NominetEPP::Contact::Update.new('sh8013',
|
67
|
+
:add => {
|
68
|
+
:trad_name => "Trading name",
|
69
|
+
:type => "LTD",
|
70
|
+
:co_no => "12345678" },
|
71
|
+
:chg => {
|
72
|
+
:opt_out => false})
|
73
|
+
@xml = prepare_request.to_xml
|
74
|
+
|
75
|
+
namespaces_from_request
|
76
|
+
end
|
77
|
+
|
78
|
+
should 'validate against schema' do
|
79
|
+
assert @xml.validate_schema(schema)
|
80
|
+
end
|
81
|
+
|
82
|
+
should 'have update element' do
|
83
|
+
assert xpath_exists?('//contact:update'), "should have update element"
|
84
|
+
end
|
85
|
+
|
86
|
+
should 'have name element' do
|
87
|
+
assert_equal 'sh8013', xpath_find('//contact:id')
|
88
|
+
end
|
89
|
+
|
90
|
+
should 'have contact extension element' do
|
91
|
+
assert xpath_exists?('//contact-ext:update'), "should have extension update element"
|
92
|
+
end
|
93
|
+
|
94
|
+
should 'set trad-name' do
|
95
|
+
assert_equal "Trading name", xpath_find('//contact-ext:trad-name')
|
96
|
+
end
|
97
|
+
|
98
|
+
should 'set type' do
|
99
|
+
assert_equal "LTD", xpath_find('//contact-ext:type')
|
100
|
+
end
|
101
|
+
|
102
|
+
should 'set co-no' do
|
103
|
+
assert_equal "12345678", xpath_find('//contact-ext:co-no')
|
104
|
+
end
|
105
|
+
|
106
|
+
should 'set opt-out' do
|
107
|
+
assert_equal "N", xpath_find('//contact-ext:opt-out')
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestNominetCustomHandshakeRequest < Test::Unit::TestCase
|
4
|
+
context 'NominetEPP::Custom::Handshake' do
|
5
|
+
context 'without registrant' do
|
6
|
+
setup do
|
7
|
+
@request = NominetEPP::Custom::Handshake.new('123456')
|
8
|
+
@xml = prepare_request.to_xml
|
9
|
+
|
10
|
+
namespaces_from_request
|
11
|
+
end
|
12
|
+
|
13
|
+
should 'validate against schema' do
|
14
|
+
assert @xml.validate_schema(schema)
|
15
|
+
end
|
16
|
+
|
17
|
+
should 'have caseId' do
|
18
|
+
assert_equal '123456', xpath_find('//h:caseId')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
context 'with registrant' do
|
22
|
+
setup do
|
23
|
+
@request = NominetEPP::Custom::Handshake.new('123456', 'sh8013')
|
24
|
+
@xml = prepare_request.to_xml
|
25
|
+
|
26
|
+
namespaces_from_request
|
27
|
+
end
|
28
|
+
|
29
|
+
should 'validate against schema' do
|
30
|
+
assert @xml.validate_schema(schema)
|
31
|
+
end
|
32
|
+
|
33
|
+
should 'have caseId' do
|
34
|
+
assert_equal '123456', xpath_find('//h:caseId')
|
35
|
+
end
|
36
|
+
|
37
|
+
should 'have registrant' do
|
38
|
+
assert_equal 'sh8013', xpath_find('//h:registrant')
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestNominetCustomListRequest < Test::Unit::TestCase
|
4
|
+
context 'NominetEPP::Custom::List' do
|
5
|
+
context 'expiry' do
|
6
|
+
setup do
|
7
|
+
@request = NominetEPP::Custom::List.new('expiry', '2013-09')
|
8
|
+
@xml = prepare_request.to_xml
|
9
|
+
|
10
|
+
namespaces_from_request
|
11
|
+
end
|
12
|
+
|
13
|
+
should 'validate against schema' do
|
14
|
+
assert @xml.validate_schema(schema)
|
15
|
+
end
|
16
|
+
|
17
|
+
should 'have expiry element' do
|
18
|
+
assert xpath_exists?('//l:expiry')
|
19
|
+
end
|
20
|
+
should 'have current date for expiry' do
|
21
|
+
assert_equal '2013-09', xpath_find('//l:expiry')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
context 'registrations' do
|
25
|
+
setup do
|
26
|
+
@request = NominetEPP::Custom::List.new('registration', '2013-09')
|
27
|
+
@xml = prepare_request.to_xml
|
28
|
+
|
29
|
+
namespaces_from_request
|
30
|
+
end
|
31
|
+
|
32
|
+
should 'validate against schema' do
|
33
|
+
assert @xml.validate_schema(schema)
|
34
|
+
end
|
35
|
+
|
36
|
+
should 'have month element' do
|
37
|
+
assert xpath_exists?('//l:month')
|
38
|
+
end
|
39
|
+
should 'have current date for month' do
|
40
|
+
assert_equal '2013-09', xpath_find('//l:month')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestNominetCustomTagListRequest < Test::Unit::TestCase
|
4
|
+
context 'NominetEPP::Custom::TagList' do
|
5
|
+
setup do
|
6
|
+
@schema = load_schema('nom-root-tag-1.0')
|
7
|
+
@request = NominetEPP::Custom::TagList.new
|
8
|
+
@xml = prepare_request.to_xml
|
9
|
+
|
10
|
+
namespaces_from_request
|
11
|
+
end
|
12
|
+
|
13
|
+
should 'validate against schema' do
|
14
|
+
assert @xml.validate_schema(@schema)
|
15
|
+
end
|
16
|
+
|
17
|
+
should 'have tag:list element' do
|
18
|
+
assert xpath_exists?('//tag:list')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestNominetDomainCheckRequest < Test::Unit::TestCase
|
4
|
+
context 'NominetEPP::Domain::Check' do
|
5
|
+
setup do
|
6
|
+
@request = NominetEPP::Domain::Check.new('example.co.uk', 'example.me.uk')
|
7
|
+
@xml = prepare_request.to_xml
|
8
|
+
|
9
|
+
namespaces_from_request
|
10
|
+
end
|
11
|
+
|
12
|
+
should 'validate against schema' do
|
13
|
+
assert @xml.validate_schema(schema)
|
14
|
+
end
|
15
|
+
|
16
|
+
should 'include names' do
|
17
|
+
names = []
|
18
|
+
xpath_each('//domain:name') do |node|
|
19
|
+
names << node.content.strip
|
20
|
+
end
|
21
|
+
|
22
|
+
assert_equal %w(example.co.uk example.me.uk), names
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'NominetEPP::Domain::Check Direct Rights' do
|
27
|
+
context 'registrant' do
|
28
|
+
setup do
|
29
|
+
@request = NominetEPP::Domain::Check.new('example.uk', :registrant => '239r79343')
|
30
|
+
@xml = prepare_request.to_xml
|
31
|
+
|
32
|
+
namespaces_from_request
|
33
|
+
end
|
34
|
+
|
35
|
+
should 'validate against schema' do
|
36
|
+
assert @xml.validate_schema(schema)
|
37
|
+
end
|
38
|
+
|
39
|
+
should 'include name' do
|
40
|
+
names = []
|
41
|
+
xpath_each('//domain:name') do |node|
|
42
|
+
names << node.content.strip
|
43
|
+
end
|
44
|
+
|
45
|
+
assert_equal %w(example.uk), names
|
46
|
+
end
|
47
|
+
|
48
|
+
should 'include direct-rights extension' do
|
49
|
+
assert xpath_exists?('//nom-direct-rights:check'), "should have extension create element"
|
50
|
+
end
|
51
|
+
|
52
|
+
should 'have registrant element' do
|
53
|
+
assert_equal '239r79343', xpath_find('//nom-direct-rights:registrant')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'postal info & email' do
|
58
|
+
setup do
|
59
|
+
@request = NominetEPP::Domain::Check.new('example.uk',
|
60
|
+
:email => "enoch.root@test.host",
|
61
|
+
:postal_info => {
|
62
|
+
:org => "Epiphyte",
|
63
|
+
:name => "Enoch Root",
|
64
|
+
:addr => {
|
65
|
+
:street => "1 Test Avenue",
|
66
|
+
:city => "Testington",
|
67
|
+
:sp => "Testshire",
|
68
|
+
:pc => "TE57 1NG",
|
69
|
+
:cc => "GB" } })
|
70
|
+
@xml = prepare_request.to_xml
|
71
|
+
|
72
|
+
namespaces_from_request
|
73
|
+
end
|
74
|
+
|
75
|
+
should 'validate against schema' do
|
76
|
+
assert @xml.validate_schema(schema)
|
77
|
+
end
|
78
|
+
|
79
|
+
should 'include name' do
|
80
|
+
names = []
|
81
|
+
xpath_each('//domain:name') do |node|
|
82
|
+
names << node.content.strip
|
83
|
+
end
|
84
|
+
|
85
|
+
assert_equal %w(example.uk), names
|
86
|
+
end
|
87
|
+
|
88
|
+
should 'include direct-rights extension' do
|
89
|
+
assert xpath_exists?('//nom-direct-rights:check'), "should have extension create element"
|
90
|
+
end
|
91
|
+
|
92
|
+
should 'set email' do
|
93
|
+
assert_equal "enoch.root@test.host", xpath_find('//nom-direct-rights:email')
|
94
|
+
end
|
95
|
+
should 'set organisation' do
|
96
|
+
assert_equal "Epiphyte", xpath_find('//nom-direct-rights:postalInfo/contact:org')
|
97
|
+
end
|
98
|
+
should 'set name' do
|
99
|
+
assert_equal "Enoch Root", xpath_find('//nom-direct-rights:postalInfo/contact:name')
|
100
|
+
end
|
101
|
+
should 'set address' do
|
102
|
+
assert_equal "1 Test Avenue", xpath_find('//nom-direct-rights:postalInfo/contact:addr/contact:street')
|
103
|
+
assert_equal "Testington", xpath_find('//nom-direct-rights:postalInfo/contact:addr/contact:city')
|
104
|
+
assert_equal "Testshire", xpath_find('//nom-direct-rights:postalInfo/contact:addr/contact:sp')
|
105
|
+
assert_equal "TE57 1NG", xpath_find('//nom-direct-rights:postalInfo/contact:addr/contact:pc')
|
106
|
+
assert_equal "GB", xpath_find('//nom-direct-rights:postalInfo/contact:addr/contact:cc')
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
context 'argument errors' do
|
111
|
+
should 'raise argument error if rights requested with multiple names' do
|
112
|
+
assert_raises ArgumentError do
|
113
|
+
NominetEPP::Domain::Check.new('example.uk', 'example2.uk',
|
114
|
+
:registrant => '239r79343')
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
should 'raise argument error if registrant given with other keys' do
|
119
|
+
assert_raises ArgumentError do
|
120
|
+
NominetEPP::Domain::Check.new('example.uk',
|
121
|
+
:registrant => '239r79343', :email => 'example@example.co.uk')
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
should 'raise argument error if postal info given without email' do
|
126
|
+
assert_raises ArgumentError do
|
127
|
+
NominetEPP::Domain::Check.new('example.uk',
|
128
|
+
:postal_info => { :name => "Joe Bloggs" })
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
should 'raise argument error if email given without postal info' do
|
133
|
+
assert_raises ArgumentError do
|
134
|
+
NominetEPP::Domain::Check.new('example.uk',
|
135
|
+
:email => 'example@example.co.uk')
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|