epp-client 0.0.3 → 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/.simplecov +16 -0
- data/.travis.yml +11 -0
- data/.yardopts +4 -0
- data/Gemfile +20 -0
- data/Gemfile.lock +51 -0
- data/LICENSE +1 -1
- data/README.md +75 -0
- data/Rakefile +2 -37
- data/epp-client.gemspec +15 -58
- data/gemfiles/Gemfile.ruby18 +13 -0
- data/lib/epp-client.rb +94 -7
- data/lib/epp-client/client.rb +117 -20
- data/lib/epp-client/commands/check.rb +11 -0
- data/lib/epp-client/commands/command.rb +24 -0
- data/lib/epp-client/commands/create.rb +11 -0
- data/lib/epp-client/commands/delete.rb +11 -0
- data/lib/epp-client/commands/info.rb +11 -0
- data/lib/epp-client/commands/login.rb +40 -0
- data/lib/epp-client/commands/logout.rb +11 -0
- data/lib/epp-client/commands/poll.rb +28 -0
- data/lib/epp-client/commands/read_write_command.rb +18 -0
- data/lib/epp-client/commands/renew.rb +11 -0
- data/lib/epp-client/commands/transfer.rb +25 -0
- data/lib/epp-client/commands/update.rb +11 -0
- data/lib/epp-client/contact/check.rb +23 -0
- data/lib/epp-client/contact/check_response.rb +22 -0
- data/lib/epp-client/contact/command.rb +87 -0
- data/lib/epp-client/contact/create.rb +34 -0
- data/lib/epp-client/contact/create_response.rb +14 -0
- data/lib/epp-client/contact/delete.rb +21 -0
- data/lib/epp-client/contact/delete_response.rb +9 -0
- data/lib/epp-client/contact/info.rb +21 -0
- data/lib/epp-client/contact/info_response.rb +74 -0
- data/lib/epp-client/contact/response.rb +34 -0
- data/lib/epp-client/contact/transfer.rb +21 -0
- data/lib/epp-client/contact/transfer_response.rb +26 -0
- data/lib/epp-client/contact/update.rb +80 -0
- data/lib/epp-client/contact/update_response.rb +9 -0
- data/lib/epp-client/domain/check.rb +23 -0
- data/lib/epp-client/domain/check_response.rb +22 -0
- data/lib/epp-client/domain/command.rb +92 -0
- data/lib/epp-client/domain/create.rb +49 -0
- data/lib/epp-client/domain/create_response.rb +17 -0
- data/lib/epp-client/domain/delete.rb +21 -0
- data/lib/epp-client/domain/delete_response.rb +9 -0
- data/lib/epp-client/domain/info.rb +21 -0
- data/lib/epp-client/domain/info_response.rb +66 -0
- data/lib/epp-client/domain/renew.rb +34 -0
- data/lib/epp-client/domain/renew_response.rb +14 -0
- data/lib/epp-client/domain/response.rb +34 -0
- data/lib/epp-client/domain/transfer.rb +27 -0
- data/lib/epp-client/domain/transfer_response.rb +29 -0
- data/lib/epp-client/domain/update.rb +81 -0
- data/lib/epp-client/domain/update_response.rb +9 -0
- data/lib/epp-client/host/check.rb +23 -0
- data/lib/epp-client/host/check_response.rb +22 -0
- data/lib/epp-client/host/command.rb +47 -0
- data/lib/epp-client/host/create.rb +24 -0
- data/lib/epp-client/host/create_response.rb +14 -0
- data/lib/epp-client/host/delete.rb +21 -0
- data/lib/epp-client/host/delete_response.rb +9 -0
- data/lib/epp-client/host/info.rb +21 -0
- data/lib/epp-client/host/info_response.rb +42 -0
- data/lib/epp-client/host/response.rb +34 -0
- data/lib/epp-client/host/update.rb +76 -0
- data/lib/epp-client/host/update_response.rb +9 -0
- data/lib/epp-client/request.rb +29 -74
- data/lib/epp-client/requests/abstract.rb +30 -0
- data/lib/epp-client/requests/command.rb +28 -0
- data/lib/epp-client/requests/extension.rb +28 -0
- data/lib/epp-client/requests/hello.rb +12 -0
- data/lib/epp-client/response.rb +45 -8
- data/lib/epp-client/response_helper.rb +25 -0
- data/lib/epp-client/server.rb +167 -63
- data/lib/epp-client/testing.rb +59 -0
- data/lib/epp-client/version.rb +3 -0
- data/lib/epp-client/xml_helper.rb +71 -0
- data/test/commands/test_check_command.rb +33 -0
- data/test/commands/test_create_command.rb +53 -0
- data/test/commands/test_delete_command.rb +28 -0
- data/test/commands/test_info_command.rb +28 -0
- data/test/commands/test_login_command.rb +56 -0
- data/test/commands/test_logout_command.rb +22 -0
- data/test/commands/test_poll_command.rb +54 -0
- data/test/commands/test_renew_command.rb +39 -0
- data/test/commands/test_transfer_command.rb +37 -0
- data/test/commands/test_update_command.rb +60 -0
- data/test/contact/test_contact_check.rb +33 -0
- data/test/contact/test_contact_check_response.rb +38 -0
- data/test/contact/test_contact_create.rb +70 -0
- data/test/contact/test_contact_create_response.rb +33 -0
- data/test/contact/test_contact_delete.rb +28 -0
- data/test/contact/test_contact_delete_response.rb +23 -0
- data/test/contact/test_contact_info.rb +28 -0
- data/test/contact/test_contact_info_response.rb +100 -0
- data/test/contact/test_contact_transfer.rb +28 -0
- data/test/contact/test_contact_transfer_response.rb +100 -0
- data/test/contact/test_contact_update.rb +83 -0
- data/test/contact/test_contact_update_response.rb +23 -0
- data/test/domain/test_domain_check.rb +33 -0
- data/test/domain/test_domain_check_response.rb +38 -0
- data/test/domain/test_domain_create.rb +53 -0
- data/test/domain/test_domain_create_response.rb +39 -0
- data/test/domain/test_domain_delete.rb +28 -0
- data/test/domain/test_domain_delete_response.rb +23 -0
- data/test/domain/test_domain_info.rb +28 -0
- data/test/domain/test_domain_info_response.rb +107 -0
- data/test/domain/test_domain_renew.rb +39 -0
- data/test/domain/test_domain_renew_response.rb +32 -0
- data/test/domain/test_domain_transfer.rb +37 -0
- data/test/domain/test_domain_transfer_response.rb +112 -0
- data/test/domain/test_domain_update.rb +73 -0
- data/test/domain/test_domain_update_response.rb +23 -0
- data/test/fixtures/responses/contact/check.xml +27 -0
- data/test/fixtures/responses/contact/create.xml +19 -0
- data/test/fixtures/responses/contact/delete.xml +12 -0
- data/test/fixtures/responses/contact/info.xml +49 -0
- data/test/fixtures/responses/contact/transfer-query.xml +23 -0
- data/test/fixtures/responses/contact/transfer-request.xml +23 -0
- data/test/fixtures/responses/contact/update.xml +12 -0
- data/test/fixtures/responses/domain/check.xml +27 -0
- data/test/fixtures/responses/domain/create.xml +20 -0
- data/test/fixtures/responses/domain/delete.xml +12 -0
- data/test/fixtures/responses/domain/info-no-exDate.xml +38 -0
- data/test/fixtures/responses/domain/info.xml +39 -0
- data/test/fixtures/responses/domain/renew.xml +19 -0
- data/test/fixtures/responses/domain/transfer-query.xml +24 -0
- data/test/fixtures/responses/domain/transfer-request.xml +24 -0
- data/test/fixtures/responses/domain/update.xml +12 -0
- data/test/fixtures/responses/greeting.xml +25 -0
- data/test/fixtures/responses/host/check.xml +27 -0
- data/test/fixtures/responses/host/create.xml +19 -0
- data/test/fixtures/responses/host/delete.xml +12 -0
- data/test/fixtures/responses/host/info.xml +30 -0
- data/test/fixtures/responses/host/update.xml +12 -0
- data/test/helper.rb +89 -0
- data/test/host/test_host_check.rb +33 -0
- data/test/host/test_host_check_response.rb +38 -0
- data/test/host/test_host_create.rb +37 -0
- data/test/host/test_host_create_response.rb +33 -0
- data/test/host/test_host_delete.rb +28 -0
- data/test/host/test_host_delete_response.rb +23 -0
- data/test/host/test_host_info.rb +28 -0
- data/test/host/test_host_info_response.rb +72 -0
- data/test/host/test_host_update.rb +68 -0
- data/test/host/test_host_update_response.rb +23 -0
- data/test/requests/test_command_request.rb +16 -0
- data/test/requests/test_extension_request.rb +55 -0
- data/test/requests/test_hello_request.rb +15 -0
- data/test/support/schemas/all.xsd +21 -0
- data/test/support/schemas/contact-1.0.xsd +387 -0
- data/test/support/schemas/domain-1.0.xsd +432 -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/test_client.rb +54 -0
- data/test/test_request.rb +15 -0
- data/test/test_server.rb +57 -0
- metadata +270 -91
- data/.document +0 -5
- data/README.rdoc +0 -17
- data/VERSION +0 -1
- data/lib/epp-client/hello_request.rb +0 -9
- data/test/test_epp-client.rb +0 -7
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEppContactTransferCommand < Test::Unit::TestCase
|
4
|
+
context 'EPP::Contact::Transfer' do
|
5
|
+
setup do
|
6
|
+
@contact_transfer = EPP::Contact::Transfer.new('UK-39246923864')
|
7
|
+
|
8
|
+
@transfer = EPP::Commands::Transfer.new('query', @contact_transfer)
|
9
|
+
@command = EPP::Requests::Command.new('ABC-123', @transfer)
|
10
|
+
@request = EPP::Request.new(@command)
|
11
|
+
@xml = @request.to_xml
|
12
|
+
|
13
|
+
namespaces_from_request
|
14
|
+
end
|
15
|
+
|
16
|
+
should 'validate against schema' do
|
17
|
+
assert @xml.validate_schema(schema)
|
18
|
+
end
|
19
|
+
|
20
|
+
should 'set clTRID' do
|
21
|
+
assert_equal 'ABC-123', xpath_find('//epp:clTRID')
|
22
|
+
end
|
23
|
+
|
24
|
+
should 'set UK-39246923864 as id' do
|
25
|
+
assert_equal 'UK-39246923864', xpath_find('//contact:id')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEppContactTransferResponse < Test::Unit::TestCase
|
4
|
+
context 'EPP::Contact::TransferResponse' do
|
5
|
+
context 'query' do
|
6
|
+
setup do
|
7
|
+
@response = EPP::Response.new(load_xml('contact/transfer-query'))
|
8
|
+
@transfer_response = EPP::Contact::TransferResponse.new(@response)
|
9
|
+
end
|
10
|
+
|
11
|
+
should 'proxy methods to @response' do
|
12
|
+
assert_equal @response.message, @transfer_response.message
|
13
|
+
end
|
14
|
+
|
15
|
+
should 'be successful' do
|
16
|
+
assert @transfer_response.success?
|
17
|
+
assert_equal 1000, @transfer_response.code
|
18
|
+
end
|
19
|
+
|
20
|
+
should 'have message' do
|
21
|
+
assert_equal 'Command completed successfully', @transfer_response.message
|
22
|
+
end
|
23
|
+
|
24
|
+
should 'have contact id' do
|
25
|
+
assert_equal 'sh8013', @transfer_response.id
|
26
|
+
end
|
27
|
+
|
28
|
+
should 'have transfer status' do
|
29
|
+
assert_equal 'pending', @transfer_response.status
|
30
|
+
end
|
31
|
+
|
32
|
+
should 'have request ID' do
|
33
|
+
assert_equal 'ClientX', @transfer_response.requested_id
|
34
|
+
end
|
35
|
+
|
36
|
+
should 'have request date' do
|
37
|
+
# 2000-06-06T22:00:00.0Z
|
38
|
+
expected = Time.gm(2000,6,6,22,00,00)
|
39
|
+
assert_equal expected, @transfer_response.requested_date
|
40
|
+
end
|
41
|
+
|
42
|
+
should 'have action id' do
|
43
|
+
assert_equal 'ClientY', @transfer_response.action_id
|
44
|
+
end
|
45
|
+
|
46
|
+
should 'have action date' do
|
47
|
+
# 2000-06-11T22:00:00.0Z
|
48
|
+
expected = Time.gm(2000,6,11,22,00,00)
|
49
|
+
assert_equal expected, @transfer_response.action_date
|
50
|
+
end
|
51
|
+
end
|
52
|
+
context 'request' do
|
53
|
+
setup do
|
54
|
+
@response = EPP::Response.new(load_xml('contact/transfer-request'))
|
55
|
+
@transfer_response = EPP::Contact::TransferResponse.new(@response)
|
56
|
+
end
|
57
|
+
|
58
|
+
should 'proxy methods to @response' do
|
59
|
+
assert_equal @response.message, @transfer_response.message
|
60
|
+
end
|
61
|
+
|
62
|
+
should 'be pending' do
|
63
|
+
assert @transfer_response.pending?
|
64
|
+
assert_equal 1001, @transfer_response.code
|
65
|
+
end
|
66
|
+
|
67
|
+
should 'have message' do
|
68
|
+
assert_equal 'Command completed successfully; action pending', @transfer_response.message
|
69
|
+
end
|
70
|
+
|
71
|
+
should 'have contact id' do
|
72
|
+
assert_equal 'sh8013', @transfer_response.id
|
73
|
+
end
|
74
|
+
|
75
|
+
should 'have transfer status' do
|
76
|
+
assert_equal 'pending', @transfer_response.status
|
77
|
+
end
|
78
|
+
|
79
|
+
should 'have request ID' do
|
80
|
+
assert_equal 'ClientX', @transfer_response.requested_id
|
81
|
+
end
|
82
|
+
|
83
|
+
should 'have request date' do
|
84
|
+
# 2000-06-06T22:00:00.0Z
|
85
|
+
expected = Time.gm(2000,6,8,22,00,00)
|
86
|
+
assert_equal expected, @transfer_response.requested_date
|
87
|
+
end
|
88
|
+
|
89
|
+
should 'have action id' do
|
90
|
+
assert_equal 'ClientY', @transfer_response.action_id
|
91
|
+
end
|
92
|
+
|
93
|
+
should 'have action date' do
|
94
|
+
# 2000-06-13T22:00:00.0Z
|
95
|
+
expected = Time.gm(2000,6,13,22,00,00)
|
96
|
+
assert_equal expected, @transfer_response.action_date
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEppContactUpdateCommand < Test::Unit::TestCase
|
4
|
+
context 'EPP::Contact::Update' do
|
5
|
+
setup do
|
6
|
+
@contact_update = EPP::Contact::Update.new('UK-4398495',
|
7
|
+
:add => {:status => {:ok => "Okie Dokie"}},
|
8
|
+
:rem => {:status => {:ok => ["Okie Dokie", "en"]}},
|
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
|
+
:auth_info => {:pw => '2381728348'},
|
22
|
+
:disclose => {"0" => %w(name)}
|
23
|
+
})
|
24
|
+
|
25
|
+
@update = EPP::Commands::Update.new(@contact_update)
|
26
|
+
@command = EPP::Requests::Command.new('ABC-123', @update)
|
27
|
+
@request = EPP::Request.new(@command)
|
28
|
+
@xml = @request.to_xml
|
29
|
+
|
30
|
+
namespaces_from_request
|
31
|
+
end
|
32
|
+
|
33
|
+
should 'validate against schema' do
|
34
|
+
assert @xml.validate_schema(schema)
|
35
|
+
end
|
36
|
+
|
37
|
+
should 'set clTRID' do
|
38
|
+
assert_equal 'ABC-123', xpath_find('//epp:clTRID')
|
39
|
+
end
|
40
|
+
|
41
|
+
should 'set UK-4398495 as id' do
|
42
|
+
assert_equal 'UK-4398495', xpath_find('//contact:id')
|
43
|
+
end
|
44
|
+
should 'add status' do
|
45
|
+
assert_equal "Okie Dokie", xpath_find('//contact:add/contact:status')
|
46
|
+
assert_equal "ok", xpath_find('//contact:add/contact:status/@s')
|
47
|
+
end
|
48
|
+
|
49
|
+
should 'remove status' do
|
50
|
+
assert_equal "Okie Dokie", xpath_find('//contact:rem/contact:status')
|
51
|
+
assert_equal "en", xpath_find('//contact:rem/contact:status/@lang')
|
52
|
+
assert_equal "ok", xpath_find('//contact:rem/contact:status/@s')
|
53
|
+
end
|
54
|
+
|
55
|
+
should 'set voice for change' do
|
56
|
+
assert_equal "+44.1234567890", xpath_find('//contact:chg/contact:voice')
|
57
|
+
end
|
58
|
+
should 'set email for change' do
|
59
|
+
assert_equal "enoch.root@test.host", xpath_find('//contact:chg/contact:email')
|
60
|
+
end
|
61
|
+
should 'set organisation for change' do
|
62
|
+
assert_equal "Epiphyte", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:org')
|
63
|
+
end
|
64
|
+
should 'set name for change' do
|
65
|
+
assert_equal "Enoch Root", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:name')
|
66
|
+
end
|
67
|
+
should 'set address for change' do
|
68
|
+
assert_equal "1 Test Avenue", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:addr/contact:street')
|
69
|
+
assert_equal "Testington", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:addr/contact:city')
|
70
|
+
assert_equal "Testshire", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:addr/contact:sp')
|
71
|
+
assert_equal "TE57 1NG", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:addr/contact:pc')
|
72
|
+
assert_equal "GB", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:addr/contact:cc')
|
73
|
+
end
|
74
|
+
|
75
|
+
should 'set authInfo for change' do
|
76
|
+
assert_equal '2381728348', xpath_find('//contact:chg/contact:authInfo/contact:pw')
|
77
|
+
end
|
78
|
+
|
79
|
+
should 'set disclose for change' do
|
80
|
+
assert xpath_exists?('//contact:chg/contact:disclose[@flag="0"]/contact:name'), "should disallow disclose of name"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEppContactUpdateResponse < Test::Unit::TestCase
|
4
|
+
context 'EPP::Contact::UpdateResponse' do
|
5
|
+
setup do
|
6
|
+
@response = EPP::Response.new(load_xml('contact/update'))
|
7
|
+
@update_response = EPP::Contact::UpdateResponse.new(@response)
|
8
|
+
end
|
9
|
+
|
10
|
+
should 'proxy methods to @response' do
|
11
|
+
assert_equal @response.message, @update_response.message
|
12
|
+
end
|
13
|
+
|
14
|
+
should 'be successful' do
|
15
|
+
assert @update_response.success?
|
16
|
+
assert_equal 1000, @update_response.code
|
17
|
+
end
|
18
|
+
|
19
|
+
should 'have message' do
|
20
|
+
assert_equal 'Command completed successfully', @update_response.message
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEppDomainCheckCommand < Test::Unit::TestCase
|
4
|
+
context 'EPP::Domain::Check' do
|
5
|
+
setup do
|
6
|
+
@domain_check = EPP::Domain::Check.new('example.com', 'example.net')
|
7
|
+
|
8
|
+
@check = EPP::Commands::Check.new(@domain_check)
|
9
|
+
@command = EPP::Requests::Command.new('ABC-123', @check)
|
10
|
+
@request = EPP::Request.new(@command)
|
11
|
+
@xml = @request.to_xml
|
12
|
+
|
13
|
+
namespaces_from_request
|
14
|
+
end
|
15
|
+
|
16
|
+
should 'validate against schema' do
|
17
|
+
assert @xml.validate_schema(schema)
|
18
|
+
end
|
19
|
+
|
20
|
+
should 'set clTRID' do
|
21
|
+
assert_equal 'ABC-123', xpath_find('//epp:clTRID')
|
22
|
+
end
|
23
|
+
|
24
|
+
should 'set names' do
|
25
|
+
names = []
|
26
|
+
xpath_each('//domain:name') do |node|
|
27
|
+
names << node.content.strip
|
28
|
+
end
|
29
|
+
|
30
|
+
assert_equal %w(example.com example.net), names
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEppDomainCheckResponse < Test::Unit::TestCase
|
4
|
+
context 'EPP::Domain::CheckResponse' do
|
5
|
+
setup do
|
6
|
+
@response = EPP::Response.new(load_xml('domain/check'))
|
7
|
+
@check_response = EPP::Domain::CheckResponse.new(@response)
|
8
|
+
end
|
9
|
+
|
10
|
+
should 'proxy methods to @response' do
|
11
|
+
assert_equal @response.message, @check_response.message
|
12
|
+
end
|
13
|
+
|
14
|
+
should 'be successful' do
|
15
|
+
assert @check_response.success?
|
16
|
+
assert_equal 1000, @check_response.code
|
17
|
+
end
|
18
|
+
|
19
|
+
should 'have message' do
|
20
|
+
assert_equal 'Command completed successfully', @check_response.message
|
21
|
+
end
|
22
|
+
|
23
|
+
should 'list example.com as available' do
|
24
|
+
assert @check_response.available?('example.com')
|
25
|
+
assert !@check_response.unavailable?('example.com')
|
26
|
+
end
|
27
|
+
|
28
|
+
should 'list example.net as unavailable' do
|
29
|
+
assert @check_response.unavailable?('example.net')
|
30
|
+
assert !@check_response.available?('example.net')
|
31
|
+
end
|
32
|
+
|
33
|
+
should 'list example.org as available' do
|
34
|
+
assert @check_response.available?('example.org')
|
35
|
+
assert !@check_response.unavailable?('example.org')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEppDomainCreateCommand < Test::Unit::TestCase
|
4
|
+
context 'EPP::Domain::Create' do
|
5
|
+
setup do
|
6
|
+
@domain_create = EPP::Domain::Create.new('example.com',
|
7
|
+
:period => '2y', :registrant => 'UK-2349723',
|
8
|
+
:nameservers => %w(ns1.test.host ns2.test.host),
|
9
|
+
:auth_info => {:pw => '2381728348'})
|
10
|
+
|
11
|
+
@create = EPP::Commands::Create.new(@domain_create)
|
12
|
+
@command = EPP::Requests::Command.new('ABC-123', @create)
|
13
|
+
@request = EPP::Request.new(@command)
|
14
|
+
@xml = @request.to_xml
|
15
|
+
|
16
|
+
namespaces_from_request
|
17
|
+
end
|
18
|
+
|
19
|
+
should 'validate against schema' do
|
20
|
+
assert @xml.validate_schema(schema)
|
21
|
+
end
|
22
|
+
|
23
|
+
should 'set clTRID' do
|
24
|
+
assert_equal 'ABC-123', xpath_find('//epp:clTRID')
|
25
|
+
end
|
26
|
+
|
27
|
+
should 'set example.com as name' do
|
28
|
+
assert_equal 'example.com', xpath_find('//domain:name')
|
29
|
+
end
|
30
|
+
|
31
|
+
should 'set period' do
|
32
|
+
assert_equal '2', xpath_find('//domain:period')
|
33
|
+
assert_equal 'y', xpath_find('//domain:period/@unit')
|
34
|
+
end
|
35
|
+
|
36
|
+
should 'set registrant' do
|
37
|
+
assert_equal 'UK-2349723', xpath_find('//domain:registrant')
|
38
|
+
end
|
39
|
+
|
40
|
+
should 'set nameservers' do
|
41
|
+
nameservers = []
|
42
|
+
xpath_each('//domain:ns/domain:hostObj') do |node|
|
43
|
+
nameservers << node.content.strip
|
44
|
+
end
|
45
|
+
|
46
|
+
assert_equal %w(ns1.test.host ns2.test.host), nameservers
|
47
|
+
end
|
48
|
+
|
49
|
+
should 'set authInfo' do
|
50
|
+
assert_equal '2381728348', xpath_find('//domain:authInfo/domain:pw')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEppDomainCreateResponse < Test::Unit::TestCase
|
4
|
+
context 'EPP::Domain::CreateResponse' do
|
5
|
+
setup do
|
6
|
+
@response = EPP::Response.new(load_xml('domain/create'))
|
7
|
+
@create_response = EPP::Domain::CreateResponse.new(@response)
|
8
|
+
end
|
9
|
+
|
10
|
+
should 'proxy methods to @response' do
|
11
|
+
assert_equal @response.message, @create_response.message
|
12
|
+
end
|
13
|
+
|
14
|
+
should 'be successful' do
|
15
|
+
assert @create_response.success?
|
16
|
+
assert_equal 1000, @create_response.code
|
17
|
+
end
|
18
|
+
|
19
|
+
should 'have message' do
|
20
|
+
assert_equal 'Command completed successfully', @create_response.message
|
21
|
+
end
|
22
|
+
|
23
|
+
should 'have name example.com' do
|
24
|
+
assert_equal 'example.com', @create_response.name
|
25
|
+
end
|
26
|
+
|
27
|
+
should 'have new creation date' do
|
28
|
+
# 1999-04-03T22:00:00.0Z
|
29
|
+
expected = Time.gm(1999,04,03,22,00,00)
|
30
|
+
assert_equal expected, @create_response.creation_date
|
31
|
+
end
|
32
|
+
|
33
|
+
should 'have new expiration date' do
|
34
|
+
# 2001-04-03T22:00:00.0Z
|
35
|
+
expected = Time.gm(2001,04,03,22,00,00)
|
36
|
+
assert_equal expected, @create_response.expiration_date
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEppDomainDeleteCommand < Test::Unit::TestCase
|
4
|
+
context 'EPP::Domain::Delete' do
|
5
|
+
setup do
|
6
|
+
@domain_delete = EPP::Domain::Delete.new('example.com')
|
7
|
+
|
8
|
+
@delete = EPP::Commands::Delete.new(@domain_delete)
|
9
|
+
@command = EPP::Requests::Command.new('ABC-123', @delete)
|
10
|
+
@request = EPP::Request.new(@command)
|
11
|
+
@xml = @request.to_xml
|
12
|
+
|
13
|
+
namespaces_from_request
|
14
|
+
end
|
15
|
+
|
16
|
+
should 'validate against schema' do
|
17
|
+
assert @xml.validate_schema(schema)
|
18
|
+
end
|
19
|
+
|
20
|
+
should 'set clTRID' do
|
21
|
+
assert_equal 'ABC-123', xpath_find('//epp:clTRID')
|
22
|
+
end
|
23
|
+
|
24
|
+
should 'set example.com as name' do
|
25
|
+
assert_equal 'example.com', xpath_find('//domain:name')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEppDomainDeleteResponse < Test::Unit::TestCase
|
4
|
+
context 'EPP::Domain::DeleteResponse' do
|
5
|
+
setup do
|
6
|
+
@response = EPP::Response.new(load_xml('domain/delete'))
|
7
|
+
@delete_response = EPP::Domain::DeleteResponse.new(@response)
|
8
|
+
end
|
9
|
+
|
10
|
+
should 'proxy methods to @response' do
|
11
|
+
assert_equal @response.message, @delete_response.message
|
12
|
+
end
|
13
|
+
|
14
|
+
should 'be successful' do
|
15
|
+
assert @delete_response.success?
|
16
|
+
assert_equal 1000, @delete_response.code
|
17
|
+
end
|
18
|
+
|
19
|
+
should 'have message' do
|
20
|
+
assert_equal 'Command completed successfully', @delete_response.message
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|