epp-client 0.0.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,37 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppTransferCommand < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Commands::Transfer' do
|
|
5
|
+
setup do
|
|
6
|
+
@domain_transfer = EPP::Domain::Transfer.new('example.com', '12m', :pw => '2381728348')
|
|
7
|
+
|
|
8
|
+
@transfer = EPP::Commands::Transfer.new('query', @domain_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 example.com as name' do
|
|
25
|
+
assert_equal 'example.com', xpath_find('//domain:name')
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
should 'set period' do
|
|
29
|
+
assert_equal '12', xpath_find('//domain:period')
|
|
30
|
+
assert_equal 'm', xpath_find('//domain:period/@unit')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
should 'set authInfo' do
|
|
34
|
+
assert_equal '2381728348', xpath_find('//domain:authInfo/domain:pw')
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppUpdateCommand < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Commands::Update' do
|
|
5
|
+
setup do
|
|
6
|
+
@domain_update = EPP::Domain::Update.new('example.com',
|
|
7
|
+
:add => {:ns => %w(ns1.test.host ns2.test.host)},
|
|
8
|
+
:rem => {:ns => %w(ns3.test.host ns4.test.host)},
|
|
9
|
+
:chg => {
|
|
10
|
+
:registrant => 'UK-2349723',
|
|
11
|
+
:auth_info => {:pw => '2381728348'}
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
@update = EPP::Commands::Update.new(@domain_update)
|
|
15
|
+
@command = EPP::Requests::Command.new('ABC-123', @update)
|
|
16
|
+
@request = EPP::Request.new(@command)
|
|
17
|
+
@xml = @request.to_xml
|
|
18
|
+
|
|
19
|
+
namespaces_from_request
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
should 'validate against schema' do
|
|
23
|
+
assert @xml.validate_schema(schema)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
should 'set clTRID' do
|
|
27
|
+
assert_equal 'ABC-123', xpath_find('//epp:clTRID')
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
should 'set example.com as name' do
|
|
31
|
+
assert_equal 'example.com', xpath_find('//domain:name')
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
should 'add nameservers' do
|
|
35
|
+
nameservers = []
|
|
36
|
+
xpath_each('//domain:add/domain:ns/domain:hostObj') do |node|
|
|
37
|
+
nameservers << node.content.strip
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
assert_equal %w(ns1.test.host ns2.test.host), nameservers
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
should 'remove nameservers' do
|
|
44
|
+
nameservers = []
|
|
45
|
+
xpath_each('//domain:rem/domain:ns/domain:hostObj') do |node|
|
|
46
|
+
nameservers << node.content.strip
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
assert_equal %w(ns3.test.host ns4.test.host), nameservers
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
should 'set registant for change' do
|
|
53
|
+
assert_equal 'UK-2349723', xpath_find('//domain:chg/domain:registrant')
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
should 'set authInfo for change' do
|
|
57
|
+
assert_equal '2381728348', xpath_find('//domain:chg/domain:authInfo/domain:pw')
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppContactCheckCommand < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Contact::Check' do
|
|
5
|
+
setup do
|
|
6
|
+
@contact_check = EPP::Contact::Check.new('UK-39246923864', 'UK-23489239')
|
|
7
|
+
|
|
8
|
+
@check = EPP::Commands::Check.new(@contact_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 ids' do
|
|
25
|
+
ids = []
|
|
26
|
+
xpath_each('//contact:id') do |node|
|
|
27
|
+
ids << node.content.strip
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
assert_equal %w(UK-39246923864 UK-23489239), ids
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppContactCheckResponse < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Contact::CheckResponse' do
|
|
5
|
+
setup do
|
|
6
|
+
@response = EPP::Response.new(load_xml('contact/check'))
|
|
7
|
+
@check_response = EPP::Contact::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 sh8013 as available' do
|
|
24
|
+
assert @check_response.available?('sh8013')
|
|
25
|
+
assert !@check_response.unavailable?('sh8013')
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
should 'list sah8013 as unavailable' do
|
|
29
|
+
assert @check_response.unavailable?('sah8013')
|
|
30
|
+
assert !@check_response.available?('sah8013')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
should 'list 8013sah as available' do
|
|
34
|
+
assert @check_response.available?('8013sah')
|
|
35
|
+
assert !@check_response.unavailable?('8013sah')
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppContactCreateCommand < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Contact::Create' do
|
|
5
|
+
setup do
|
|
6
|
+
@contact_create = EPP::Contact::Create.new('UK-4398495',
|
|
7
|
+
:voice => "+44.1234567890",
|
|
8
|
+
:email => "enoch.root@test.host",
|
|
9
|
+
:postal_info => {
|
|
10
|
+
:org => "Epiphyte",
|
|
11
|
+
:name => "Enoch Root",
|
|
12
|
+
:addr => {
|
|
13
|
+
:street => "1 Test Avenue",
|
|
14
|
+
:city => "Testington",
|
|
15
|
+
:sp => "Testshire",
|
|
16
|
+
:pc => "TE57 1NG",
|
|
17
|
+
:cc => "GB" } },
|
|
18
|
+
:auth_info => {:pw => '2381728348'},
|
|
19
|
+
:disclose => {"0" => %w(voice email)})
|
|
20
|
+
|
|
21
|
+
@create = EPP::Commands::Create.new(@contact_create)
|
|
22
|
+
@command = EPP::Requests::Command.new('ABC-123', @create)
|
|
23
|
+
@request = EPP::Request.new(@command)
|
|
24
|
+
@xml = @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 'set clTRID' do
|
|
34
|
+
assert_equal 'ABC-123', xpath_find('//epp:clTRID')
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
should 'set id' do
|
|
38
|
+
assert_equal 'UK-4398495', xpath_find('//contact:id')
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
should 'set voice' do
|
|
42
|
+
assert_equal "+44.1234567890", xpath_find('//contact:voice')
|
|
43
|
+
end
|
|
44
|
+
should 'set email' do
|
|
45
|
+
assert_equal "enoch.root@test.host", xpath_find('//contact:email')
|
|
46
|
+
end
|
|
47
|
+
should 'set organisation' do
|
|
48
|
+
assert_equal "Epiphyte", xpath_find('//contact:postalInfo[@type="loc"]/contact:org')
|
|
49
|
+
end
|
|
50
|
+
should 'set name' do
|
|
51
|
+
assert_equal "Enoch Root", xpath_find('//contact:postalInfo[@type="loc"]/contact:name')
|
|
52
|
+
end
|
|
53
|
+
should 'set address' do
|
|
54
|
+
assert_equal "1 Test Avenue", xpath_find('//contact:postalInfo[@type="loc"]/contact:addr/contact:street')
|
|
55
|
+
assert_equal "Testington", xpath_find('//contact:postalInfo[@type="loc"]/contact:addr/contact:city')
|
|
56
|
+
assert_equal "Testshire", xpath_find('//contact:postalInfo[@type="loc"]/contact:addr/contact:sp')
|
|
57
|
+
assert_equal "TE57 1NG", xpath_find('//contact:postalInfo[@type="loc"]/contact:addr/contact:pc')
|
|
58
|
+
assert_equal "GB", xpath_find('//contact:postalInfo[@type="loc"]/contact:addr/contact:cc')
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
should 'set authInfo' do
|
|
62
|
+
assert_equal '2381728348', xpath_find('//contact:authInfo/contact:pw')
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
should 'set disclose' do
|
|
66
|
+
assert xpath_exists?('//contact:disclose[@flag="0"]/contact:email'), "should disallow disclose of email"
|
|
67
|
+
assert xpath_exists?('//contact:disclose[@flag="0"]/contact:voice'), "should disallow disclose of voice"
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppContactCreateResponse < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Contact::CreateResponse' do
|
|
5
|
+
setup do
|
|
6
|
+
@response = EPP::Response.new(load_xml('contact/create'))
|
|
7
|
+
@create_response = EPP::Contact::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 id sh8013' do
|
|
24
|
+
assert_equal 'sh8013', @create_response.id
|
|
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
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppContactDeleteCommand < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Contact::Delete' do
|
|
5
|
+
setup do
|
|
6
|
+
@contact_delete = EPP::Contact::Delete.new('UK-39246923864')
|
|
7
|
+
|
|
8
|
+
@delete = EPP::Commands::Delete.new(@contact_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 'UK-39246923864', xpath_find('//contact:id')
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppContactDeleteResponse < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Contact::DeleteResponse' do
|
|
5
|
+
setup do
|
|
6
|
+
@response = EPP::Response.new(load_xml('contact/delete'))
|
|
7
|
+
@delete_response = EPP::Contact::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
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppContactInfoCommand < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Contact::Info' do
|
|
5
|
+
setup do
|
|
6
|
+
@contact_info = EPP::Contact::Info.new('UK-39246923864')
|
|
7
|
+
|
|
8
|
+
@info = EPP::Commands::Info.new(@contact_info)
|
|
9
|
+
@command = EPP::Requests::Command.new('ABC-123', @info)
|
|
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 TestEppContactInfoResponse < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Contact::InfoResponse' do
|
|
5
|
+
setup do
|
|
6
|
+
@response = EPP::Response.new(load_xml('contact/info'))
|
|
7
|
+
@info_response = EPP::Contact::InfoResponse.new(@response)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
should 'proxy methods to @response' do
|
|
11
|
+
assert_equal @response.message, @info_response.message
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
should 'be successful' do
|
|
15
|
+
assert @info_response.success?
|
|
16
|
+
assert_equal 1000, @info_response.code
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
should 'have message' do
|
|
20
|
+
assert_equal 'Command completed successfully', @info_response.message
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
should 'have id' do
|
|
24
|
+
assert_equal 'sh8013', @info_response.id
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
should 'have roid' do
|
|
28
|
+
assert_equal 'SH8013-REP', @info_response.roid
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
should 'have status' do
|
|
32
|
+
expected = %w(linked clientDeleteProhibited)
|
|
33
|
+
assert_equal expected, @info_response.status
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
should 'have postal_info' do
|
|
37
|
+
expected = { :name => "John Doe",
|
|
38
|
+
:org => "Example Inc.",
|
|
39
|
+
:addr => {
|
|
40
|
+
:street => "123 Example Dr.\nSuite 100",
|
|
41
|
+
:city => "Dulles",
|
|
42
|
+
:sp => "VA",
|
|
43
|
+
:pc => "20166-6503",
|
|
44
|
+
:cc => "US" }}
|
|
45
|
+
assert_equal expected, @info_response.postal_info
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
should 'have email' do
|
|
49
|
+
assert_equal 'jdoe@example.com', @info_response.email
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
should 'have voice' do
|
|
53
|
+
assert_equal '+1.7035555555.1234', @info_response.voice
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
should 'have fax' do
|
|
57
|
+
assert_equal '+1.7035555556', @info_response.fax
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
should 'have client_id' do
|
|
61
|
+
assert_equal 'ClientY', @info_response.client_id
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
should 'have creator_id' do
|
|
65
|
+
assert_equal 'ClientX', @info_response.creator_id
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
should 'have created_date' do
|
|
69
|
+
# 1999-04-03T22:00:00.0Z
|
|
70
|
+
expected = Time.gm(1999,4,3,22,00,00)
|
|
71
|
+
assert_equal expected, @info_response.created_date
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
should 'have updator_id' do
|
|
75
|
+
assert_equal 'ClientX', @info_response.updator_id
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
should 'have updated_date' do
|
|
79
|
+
# 1999-12-03T09:00:00.0Z
|
|
80
|
+
expected = Time.gm(1999,12,3,9,00,00)
|
|
81
|
+
assert_equal expected, @info_response.updated_date
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
should 'have transfer_date' do
|
|
85
|
+
# 2000-04-08T09:00:00.0Z
|
|
86
|
+
expected = Time.gm(2000,4,8,9,00,00)
|
|
87
|
+
assert_equal expected, @info_response.transfer_date
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
should 'have authInfo' do
|
|
91
|
+
expected = { 'pw' => '2fooBAR' }
|
|
92
|
+
assert_equal expected, @info_response.auth_info
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
should 'have disclose' do
|
|
96
|
+
expected = { "0" => %w(voice email) }
|
|
97
|
+
assert_equal expected, @info_response.disclose
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|