epp-ruby 3.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/CHANGELOG.md +31 -0
- data/Gemfile +20 -0
- data/Gemfile.lock +51 -0
- data/LICENSE +21 -0
- data/README.md +95 -0
- data/Rakefile +20 -0
- data/epp-ruby.gemspec +22 -0
- data/examples/contact_create.rb +28 -0
- data/examples/domain_check.rb +11 -0
- data/examples/domain_create.rb +19 -0
- data/examples/domain_info.rb +9 -0
- data/examples/host_create.rb +14 -0
- data/gemfiles/Gemfile.ruby18 +14 -0
- data/lib/epp-client/client.rb +172 -0
- 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/transfer_handshake.rb +43 -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 +41 -0
- data/lib/epp-client/contact/command.rb +106 -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 +41 -0
- data/lib/epp-client/domain/command.rb +92 -0
- data/lib/epp-client/domain/create.rb +75 -0
- data/lib/epp-client/domain/create_response.rb +29 -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 +72 -0
- data/lib/epp-client/domain/list.rb +36 -0
- data/lib/epp-client/domain/renew.rb +38 -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 +37 -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 +41 -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/old_server.rb +25 -0
- data/lib/epp-client/request.rb +51 -0
- 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 +100 -0
- data/lib/epp-client/response_error.rb +15 -0
- data/lib/epp-client/response_helper.rb +25 -0
- data/lib/epp-client/server.rb +330 -0
- 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/lib/epp-client.rb +103 -0
- data/lib/epp-ruby.rb +1 -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 +88 -0
- data/test/contact/test_contact_create.rb +71 -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 +84 -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 +88 -0
- data/test/domain/test_domain_create.rb +108 -0
- data/test/domain/test_domain_create_response.rb +70 -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 +146 -0
- data/test/domain/test_domain_renew.rb +91 -0
- data/test/domain/test_domain_renew_response.rb +32 -0
- data/test/domain/test_domain_transfer.rb +89 -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-single.xml +20 -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-single.xml +20 -0
- data/test/fixtures/responses/domain/check.xml +27 -0
- data/test/fixtures/responses/domain/create-pending.xml +12 -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-ns-hostAttr-name-only.xml +34 -0
- data/test/fixtures/responses/domain/info-ns-hostAttr.xml +38 -0
- data/test/fixtures/responses/domain/info.xml +40 -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-single.xml +20 -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 +100 -0
- data/test/host/test_host_check.rb +33 -0
- data/test/host/test_host_check_response.rb +88 -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 +64 -0
- data/test/test_request.rb +15 -0
- data/test/test_server.rb +67 -0
- metadata +322 -0
|
@@ -0,0 +1,108 @@
|
|
|
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
|
+
|
|
54
|
+
# Outside context for Ruby 1.8
|
|
55
|
+
def create_period(period)
|
|
56
|
+
EPP::Domain::Create.new('example.com',
|
|
57
|
+
:period => period, :registrant => 'UK-2349723',
|
|
58
|
+
:nameservers => %w(ns1.test.host ns2.test.host),
|
|
59
|
+
:auth_info => {:pw => '2381728348'})
|
|
60
|
+
end
|
|
61
|
+
context 'EPP::Domain::Create period' do
|
|
62
|
+
should 'accept 1m' do
|
|
63
|
+
assert_nothing_raised do
|
|
64
|
+
create_period '1m'
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
should 'accept 1y' do
|
|
68
|
+
assert_nothing_raised do
|
|
69
|
+
create_period '1m'
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
should 'accept 99m' do
|
|
73
|
+
assert_nothing_raised do
|
|
74
|
+
create_period '1m'
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
should 'accept 99y' do
|
|
78
|
+
assert_nothing_raised do
|
|
79
|
+
create_period '1m'
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
should 'reject 0m' do
|
|
83
|
+
assert_raises ArgumentError do
|
|
84
|
+
create_period '0m'
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
should 'reject 100m' do
|
|
88
|
+
assert_raises ArgumentError do
|
|
89
|
+
create_period '100m'
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
should 'reject 0y' do
|
|
93
|
+
assert_raises ArgumentError do
|
|
94
|
+
create_period '0y'
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
should 'reject 100y' do
|
|
98
|
+
assert_raises ArgumentError do
|
|
99
|
+
create_period '100y'
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
should 'reject 12c' do
|
|
103
|
+
assert_raises ArgumentError do
|
|
104
|
+
create_period '12c'
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
context 'EPP::Domain::CreateResponse (pending)' do
|
|
40
|
+
setup do
|
|
41
|
+
@response = EPP::Response.new(load_xml('domain/create-pending'))
|
|
42
|
+
@create_response = EPP::Domain::CreateResponse.new(@response)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
should 'proxy methods to @response' do
|
|
46
|
+
assert_equal @response.message, @create_response.message
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
should 'be pending' do
|
|
50
|
+
assert @create_response.pending?
|
|
51
|
+
assert_equal 1001, @create_response.code
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
should 'have message' do
|
|
55
|
+
assert_equal 'Command completed successfully; action pending', @create_response.message
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
should 'not have name example.com' do
|
|
59
|
+
assert_nil @create_response.name
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
should 'not have new creation date' do
|
|
63
|
+
assert_nil @create_response.creation_date
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
should 'not have new expiration date' do
|
|
67
|
+
assert_nil @create_response.expiration_date
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
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
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppDomainInfoCommand < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Domain::Info' do
|
|
5
|
+
setup do
|
|
6
|
+
@domain_info = EPP::Domain::Info.new('example.com')
|
|
7
|
+
|
|
8
|
+
@info = EPP::Commands::Info.new(@domain_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 example.com as name' do
|
|
25
|
+
assert_equal 'example.com', xpath_find('//domain:name')
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppDomainInfoResponse < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Domain::InfoResponse' do
|
|
5
|
+
setup do
|
|
6
|
+
@response = EPP::Response.new(load_xml('domain/info'))
|
|
7
|
+
@info_response = EPP::Domain::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 name' do
|
|
24
|
+
assert_equal 'example.com', @info_response.name
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
should 'have roid' do
|
|
28
|
+
assert_equal 'EXAMPLE1-REP', @info_response.roid
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
should 'have status' do
|
|
32
|
+
assert_equal ['ok', 'clientTransferProhibited'], @info_response.status
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
should 'have registrant' do
|
|
36
|
+
assert_equal 'jd1234', @info_response.registrant
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
should 'have contacts' do
|
|
40
|
+
expected = { 'admin' => 'sh8013', 'tech' => 'sh8013' }
|
|
41
|
+
assert_equal expected, @info_response.contacts
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
should 'have nameservers' do
|
|
45
|
+
expected = [ {'name' => 'ns1.example.com'},
|
|
46
|
+
{'name' => 'ns1.example.net'} ]
|
|
47
|
+
assert_equal expected, @info_response.nameservers
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
should 'have hosts' do
|
|
51
|
+
expected = %w(ns1.example.com ns2.example.com)
|
|
52
|
+
assert_equal expected, @info_response.hosts
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
should 'have client_id' do
|
|
56
|
+
assert_equal 'ClientX', @info_response.client_id
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
should 'have creator_id' do
|
|
60
|
+
assert_equal 'ClientY', @info_response.creator_id
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
should 'have created_date' do
|
|
64
|
+
# 1999-04-03T22:00:00.0Z
|
|
65
|
+
expected = Time.gm(1999,4,3,22,00,00)
|
|
66
|
+
assert_equal expected, @info_response.created_date
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
should 'have updator_id' do
|
|
70
|
+
assert_equal 'ClientX', @info_response.updator_id
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
should 'have updated_date' do
|
|
74
|
+
# 1999-12-03T09:00:00.0Z
|
|
75
|
+
expected = Time.gm(1999,12,3,9,00,00)
|
|
76
|
+
assert_equal expected, @info_response.updated_date
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
should 'have expiration_date' do
|
|
80
|
+
# 2005-04-03T22:00:00.0Z
|
|
81
|
+
expected = Time.gm(2005,4,3,22,00,00)
|
|
82
|
+
assert_equal expected, @info_response.expiration_date
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
should 'have transfer_date' do
|
|
86
|
+
# 2000-04-08T09:00:00.0Z
|
|
87
|
+
expected = Time.gm(2000,4,8,9,00,00)
|
|
88
|
+
assert_equal expected, @info_response.transfer_date
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
should 'have authInfo' do
|
|
92
|
+
expected = { 'pw' => '2fooBAR' }
|
|
93
|
+
assert_equal expected, @info_response.auth_info
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
context 'no expiration_date' do
|
|
97
|
+
setup do
|
|
98
|
+
@response = EPP::Response.new(load_xml('domain/info-no-exDate'))
|
|
99
|
+
@info_response = EPP::Domain::InfoResponse.new(@response)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
should 'have nil for expiration_date' do
|
|
103
|
+
assert_nil @info_response.expiration_date
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
context 'nameserver data specified inside <hostAttr>' do
|
|
108
|
+
context 'with name, ipv4 and ipv6' do
|
|
109
|
+
setup do
|
|
110
|
+
@response = EPP::Response.new(load_xml('domain/info-ns-hostAttr'))
|
|
111
|
+
@info_response = EPP::Domain::InfoResponse.new(@response)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
should 'have nameservers' do
|
|
115
|
+
expected = [
|
|
116
|
+
{
|
|
117
|
+
'name' => 'ns1.example.com',
|
|
118
|
+
'ipv4' => '192.0.2.1',
|
|
119
|
+
'ipv6' => '2002:0:0:0:0:0:C000:201'
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
'name' => 'ns2.example.com',
|
|
123
|
+
'ipv4' => '192.0.2.2',
|
|
124
|
+
'ipv6' => '1080:0:0:0:8:800:200C:417A'
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
assert_equal expected, @info_response.nameservers
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
context 'with name only' do
|
|
132
|
+
setup do
|
|
133
|
+
@response = EPP::Response.new(load_xml('domain/info-ns-hostAttr-name-only'))
|
|
134
|
+
@info_response = EPP::Domain::InfoResponse.new(@response)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
should 'have nameservers' do
|
|
138
|
+
expected = [ { 'name' => 'ns1.example.com' },
|
|
139
|
+
{ 'name' => 'ns2.example.com' }
|
|
140
|
+
]
|
|
141
|
+
assert_equal expected, @info_response.nameservers
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppDomainRenewCommand < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Domain::Renew' do
|
|
5
|
+
setup do
|
|
6
|
+
@time = Time.now
|
|
7
|
+
@domain_renew = EPP::Domain::Renew.new('example.com', @time, '12m')
|
|
8
|
+
|
|
9
|
+
@renew = EPP::Commands::Renew.new(@domain_renew)
|
|
10
|
+
@command = EPP::Requests::Command.new('ABC-123', @renew)
|
|
11
|
+
@request = EPP::Request.new(@command)
|
|
12
|
+
@xml = @request.to_xml
|
|
13
|
+
|
|
14
|
+
namespaces_from_request
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
should 'validate against schema' do
|
|
18
|
+
assert @xml.validate_schema(schema)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
should 'set clTRID' do
|
|
22
|
+
assert_equal 'ABC-123', xpath_find('//epp:clTRID')
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
should 'set example.com as name' do
|
|
26
|
+
assert_equal 'example.com', xpath_find('//domain:name')
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
should 'set date as curExpDate' do
|
|
30
|
+
date = @time.strftime('%Y-%m-%d')
|
|
31
|
+
assert_equal date, xpath_find('//domain:curExpDate')
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
should 'set period' do
|
|
35
|
+
assert_equal '12', xpath_find('//domain:period')
|
|
36
|
+
assert_equal 'm', xpath_find('//domain:period/@unit')
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Outside context for Ruby 1.8
|
|
41
|
+
def renew_period(period)
|
|
42
|
+
EPP::Domain::Renew.new('example.com', Time.now, period)
|
|
43
|
+
end
|
|
44
|
+
context 'EPP::Domain::Renew period' do
|
|
45
|
+
should 'accept 1m' do
|
|
46
|
+
assert_nothing_raised do
|
|
47
|
+
renew_period '1m'
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
should 'accept 1y' do
|
|
51
|
+
assert_nothing_raised do
|
|
52
|
+
renew_period '1m'
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
should 'accept 99m' do
|
|
56
|
+
assert_nothing_raised do
|
|
57
|
+
renew_period '1m'
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
should 'accept 99y' do
|
|
61
|
+
assert_nothing_raised do
|
|
62
|
+
renew_period '1m'
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
should 'reject 0m' do
|
|
66
|
+
assert_raises ArgumentError do
|
|
67
|
+
renew_period '0m'
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
should 'reject 100m' do
|
|
71
|
+
assert_raises ArgumentError do
|
|
72
|
+
renew_period '100m'
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
should 'reject 0y' do
|
|
76
|
+
assert_raises ArgumentError do
|
|
77
|
+
renew_period '0y'
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
should 'reject 100y' do
|
|
81
|
+
assert_raises ArgumentError do
|
|
82
|
+
renew_period '100y'
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
should 'reject 12c' do
|
|
86
|
+
assert_raises ArgumentError do
|
|
87
|
+
renew_period '12c'
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppDomainRenewResponse < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Domain::RenewResponse' do
|
|
5
|
+
setup do
|
|
6
|
+
@response = EPP::Response.new(load_xml('domain/renew'))
|
|
7
|
+
@renew_response = EPP::Domain::RenewResponse.new(@response)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
should 'proxy methods to @response' do
|
|
11
|
+
assert_equal @response.message, @renew_response.message
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
should 'be successful' do
|
|
15
|
+
assert @renew_response.success?
|
|
16
|
+
assert_equal 1000, @renew_response.code
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
should 'have message' do
|
|
20
|
+
assert_equal 'Command completed successfully', @renew_response.message
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
should 'have name example.com' do
|
|
24
|
+
assert_equal 'example.com', @renew_response.name
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
should 'have new expiration date' do
|
|
28
|
+
expected = Time.gm(2005,04,03,22,00,00)
|
|
29
|
+
assert_equal expected, @renew_response.expiration_date
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppDomainTransferCommand < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Domain::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
|
+
|
|
38
|
+
# Outside context for Ruby 1.8
|
|
39
|
+
def transfer_period(period)
|
|
40
|
+
EPP::Domain::Transfer.new('example.com', period, :pw => '2381728348')
|
|
41
|
+
end
|
|
42
|
+
context 'EPP::Domain::Transfer period' do
|
|
43
|
+
should 'accept 1m' do
|
|
44
|
+
assert_nothing_raised do
|
|
45
|
+
transfer_period '1m'
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
should 'accept 1y' do
|
|
49
|
+
assert_nothing_raised do
|
|
50
|
+
transfer_period '1m'
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
should 'accept 99m' do
|
|
54
|
+
assert_nothing_raised do
|
|
55
|
+
transfer_period '1m'
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
should 'accept 99y' do
|
|
59
|
+
assert_nothing_raised do
|
|
60
|
+
transfer_period '1m'
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
should 'reject 0m' do
|
|
64
|
+
assert_raises ArgumentError do
|
|
65
|
+
transfer_period '0m'
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
should 'reject 100m' do
|
|
69
|
+
assert_raises ArgumentError do
|
|
70
|
+
transfer_period '100m'
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
should 'reject 0y' do
|
|
74
|
+
assert_raises ArgumentError do
|
|
75
|
+
transfer_period '0y'
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
should 'reject 100y' do
|
|
79
|
+
assert_raises ArgumentError do
|
|
80
|
+
transfer_period '100y'
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
should 'reject 12c' do
|
|
84
|
+
assert_raises ArgumentError do
|
|
85
|
+
transfer_period '12c'
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|