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
data/lib/epp-client.rb
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
require 'openssl'
|
|
2
|
+
require 'socket'
|
|
3
|
+
require 'time'
|
|
4
|
+
require 'xml'
|
|
5
|
+
|
|
6
|
+
require File.expand_path('../epp-client/version', __FILE__)
|
|
7
|
+
|
|
8
|
+
# EPP Module
|
|
9
|
+
module EPP
|
|
10
|
+
# Generic error class for all EPP errors
|
|
11
|
+
class Error < RuntimeError; end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
require File.expand_path('../epp-client/xml_helper.rb', __FILE__)
|
|
15
|
+
require File.expand_path('../epp-client/response_helper.rb', __FILE__)
|
|
16
|
+
|
|
17
|
+
module EPP
|
|
18
|
+
autoload :OldServer, File.expand_path('../epp-client/old_server.rb', __FILE__)
|
|
19
|
+
|
|
20
|
+
module Requests
|
|
21
|
+
autoload :Hello, File.expand_path('../epp-client/requests/hello.rb', __FILE__)
|
|
22
|
+
autoload :Command, File.expand_path('../epp-client/requests/command.rb', __FILE__)
|
|
23
|
+
autoload :Extension, File.expand_path('../epp-client/requests/extension.rb', __FILE__)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
module Commands
|
|
27
|
+
autoload :TransferHandshake, File.expand_path('../epp-client/commands/transfer_handshake.rb', __FILE__)
|
|
28
|
+
autoload :Check, File.expand_path('../epp-client/commands/check.rb', __FILE__)
|
|
29
|
+
autoload :Create, File.expand_path('../epp-client/commands/create.rb', __FILE__)
|
|
30
|
+
autoload :Delete, File.expand_path('../epp-client/commands/delete.rb', __FILE__)
|
|
31
|
+
autoload :Info, File.expand_path('../epp-client/commands/info.rb', __FILE__)
|
|
32
|
+
autoload :Login, File.expand_path('../epp-client/commands/login.rb', __FILE__)
|
|
33
|
+
autoload :Logout, File.expand_path('../epp-client/commands/logout.rb', __FILE__)
|
|
34
|
+
autoload :Poll, File.expand_path('../epp-client/commands/poll.rb', __FILE__)
|
|
35
|
+
autoload :Renew, File.expand_path('../epp-client/commands/renew.rb', __FILE__)
|
|
36
|
+
autoload :Transfer, File.expand_path('../epp-client/commands/transfer.rb', __FILE__)
|
|
37
|
+
autoload :Update, File.expand_path('../epp-client/commands/update.rb', __FILE__)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
module Domain
|
|
41
|
+
NAMESPACE = 'urn:ietf:params:xml:ns:domain-1.0'
|
|
42
|
+
SCHEMA_LOCATION = 'urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd'
|
|
43
|
+
|
|
44
|
+
autoload :Check, File.expand_path('../epp-client/domain/check.rb', __FILE__)
|
|
45
|
+
autoload :Create, File.expand_path('../epp-client/domain/create.rb', __FILE__)
|
|
46
|
+
autoload :Delete, File.expand_path('../epp-client/domain/delete.rb', __FILE__)
|
|
47
|
+
autoload :Info, File.expand_path('../epp-client/domain/info.rb', __FILE__)
|
|
48
|
+
autoload :Renew, File.expand_path('../epp-client/domain/renew.rb', __FILE__)
|
|
49
|
+
autoload :Transfer, File.expand_path('../epp-client/domain/transfer.rb', __FILE__)
|
|
50
|
+
autoload :Update, File.expand_path('../epp-client/domain/update.rb', __FILE__)
|
|
51
|
+
autoload :List, File.expand_path('../epp-client/domain/list.rb', __FILE__)
|
|
52
|
+
|
|
53
|
+
autoload :CheckResponse, File.expand_path('../epp-client/domain/check_response.rb', __FILE__)
|
|
54
|
+
autoload :CreateResponse, File.expand_path('../epp-client/domain/create_response.rb', __FILE__)
|
|
55
|
+
autoload :DeleteResponse, File.expand_path('../epp-client/domain/delete_response.rb', __FILE__)
|
|
56
|
+
autoload :InfoResponse, File.expand_path('../epp-client/domain/info_response.rb', __FILE__)
|
|
57
|
+
autoload :RenewResponse, File.expand_path('../epp-client/domain/renew_response.rb', __FILE__)
|
|
58
|
+
autoload :TransferResponse, File.expand_path('../epp-client/domain/transfer_response.rb', __FILE__)
|
|
59
|
+
autoload :UpdateResponse, File.expand_path('../epp-client/domain/update_response.rb', __FILE__)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
module Contact
|
|
63
|
+
NAMESPACE = 'urn:ietf:params:xml:ns:contact-1.0'
|
|
64
|
+
SCHEMA_LOCATION = 'urn:ietf:params:xml:ns:contact-1.0 contact-1.0.xsd'
|
|
65
|
+
|
|
66
|
+
autoload :Check, File.expand_path('../epp-client/contact/check.rb', __FILE__)
|
|
67
|
+
autoload :Create, File.expand_path('../epp-client/contact/create.rb', __FILE__)
|
|
68
|
+
autoload :Delete, File.expand_path('../epp-client/contact/delete.rb', __FILE__)
|
|
69
|
+
autoload :Info, File.expand_path('../epp-client/contact/info.rb', __FILE__)
|
|
70
|
+
autoload :Transfer, File.expand_path('../epp-client/contact/transfer.rb', __FILE__)
|
|
71
|
+
autoload :Update, File.expand_path('../epp-client/contact/update.rb', __FILE__)
|
|
72
|
+
|
|
73
|
+
autoload :CheckResponse, File.expand_path('../epp-client/contact/check_response.rb', __FILE__)
|
|
74
|
+
autoload :CreateResponse, File.expand_path('../epp-client/contact/create_response.rb', __FILE__)
|
|
75
|
+
autoload :DeleteResponse, File.expand_path('../epp-client/contact/delete_response.rb', __FILE__)
|
|
76
|
+
autoload :InfoResponse, File.expand_path('../epp-client/contact/info_response.rb', __FILE__)
|
|
77
|
+
autoload :TransferResponse, File.expand_path('../epp-client/contact/transfer_response.rb', __FILE__)
|
|
78
|
+
autoload :UpdateResponse, File.expand_path('../epp-client/contact/update_response.rb', __FILE__)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
module Host
|
|
82
|
+
NAMESPACE = 'urn:ietf:params:xml:ns:host-1.0'
|
|
83
|
+
SCHEMA_LOCATION = 'urn:ietf:params:xml:ns:host-1.0 host-1.0.xsd'
|
|
84
|
+
|
|
85
|
+
autoload :Check, File.expand_path('../epp-client/host/check.rb', __FILE__)
|
|
86
|
+
autoload :Create, File.expand_path('../epp-client/host/create.rb', __FILE__)
|
|
87
|
+
autoload :Delete, File.expand_path('../epp-client/host/delete.rb', __FILE__)
|
|
88
|
+
autoload :Info, File.expand_path('../epp-client/host/info.rb', __FILE__)
|
|
89
|
+
autoload :Update, File.expand_path('../epp-client/host/update.rb', __FILE__)
|
|
90
|
+
|
|
91
|
+
autoload :CheckResponse, File.expand_path('../epp-client/host/check_response.rb', __FILE__)
|
|
92
|
+
autoload :CreateResponse, File.expand_path('../epp-client/host/create_response.rb', __FILE__)
|
|
93
|
+
autoload :DeleteResponse, File.expand_path('../epp-client/host/delete_response.rb', __FILE__)
|
|
94
|
+
autoload :InfoResponse, File.expand_path('../epp-client/host/info_response.rb', __FILE__)
|
|
95
|
+
autoload :UpdateResponse, File.expand_path('../epp-client/host/update_response.rb', __FILE__)
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
require File.expand_path('../epp-client/client', __FILE__)
|
|
100
|
+
require File.expand_path('../epp-client/server.rb', __FILE__)
|
|
101
|
+
require File.expand_path('../epp-client/request.rb', __FILE__)
|
|
102
|
+
require File.expand_path('../epp-client/response.rb', __FILE__)
|
|
103
|
+
require File.expand_path('../epp-client/response_error.rb', __FILE__)
|
data/lib/epp-ruby.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require File.expand_path('../epp-client', __FILE__)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppCheckCommand < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Commands::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,53 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppCreateCommand < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Commands::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,28 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppDeleteCommand < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Commands::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,28 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppInfoCommand < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Commands::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,56 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppLoginCommand < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Commands::Login' do
|
|
5
|
+
setup do
|
|
6
|
+
@options = {:lang => 'en', :version => '1.0',
|
|
7
|
+
:services => EPP::Client::DEFAULT_SERVICES,
|
|
8
|
+
:extensions => ['http://www.nominet.org.uk/epp/xml/domain-nom-ext-1.2']}
|
|
9
|
+
|
|
10
|
+
@login = EPP::Commands::Login.new('TEST', 'testing', @options)
|
|
11
|
+
@command = EPP::Requests::Command.new('ABC-123', @login)
|
|
12
|
+
@request = EPP::Request.new(@command)
|
|
13
|
+
|
|
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 TEST as clID' do
|
|
28
|
+
assert_equal 'TEST', xpath_find('//epp:clID')
|
|
29
|
+
end
|
|
30
|
+
should 'set testing as pw' do
|
|
31
|
+
assert_equal 'testing', xpath_find('//epp:pw')
|
|
32
|
+
end
|
|
33
|
+
should 'set 1.0 as version' do
|
|
34
|
+
assert_equal '1.0', xpath_find('//epp:version')
|
|
35
|
+
end
|
|
36
|
+
should 'set en as lang' do
|
|
37
|
+
assert_equal 'en', xpath_find('//epp:lang')
|
|
38
|
+
end
|
|
39
|
+
should 'set services' do
|
|
40
|
+
services = []
|
|
41
|
+
xpath_each('//epp:svcs/epp:objURI') do |node|
|
|
42
|
+
services << node.content
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
assert_equal services, @options[:services]
|
|
46
|
+
end
|
|
47
|
+
should 'set service extensions' do
|
|
48
|
+
extensions = []
|
|
49
|
+
xpath_each('//epp:svcs/epp:svcExtension/epp:extURI') do |node|
|
|
50
|
+
extensions << node.content
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
assert_equal extensions, @options[:extensions]
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppLogoutCommand < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::LogoutCommand' do
|
|
5
|
+
setup do
|
|
6
|
+
@logout = EPP::Commands::Logout.new
|
|
7
|
+
@command = EPP::Requests::Command.new('ABC-123', @logout)
|
|
8
|
+
@request = EPP::Request.new(@command)
|
|
9
|
+
@xml = @request.to_xml
|
|
10
|
+
|
|
11
|
+
namespaces_from_request
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
should 'validate against schema' do
|
|
15
|
+
assert @xml.validate_schema(schema)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
should 'set clTRID' do
|
|
19
|
+
assert_equal 'ABC-123', xpath_find('//epp:clTRID')
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppPollCommand < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Commands::Poll' do
|
|
5
|
+
context 'poll' do
|
|
6
|
+
setup do
|
|
7
|
+
@poll = EPP::Commands::Poll.new
|
|
8
|
+
@command = EPP::Requests::Command.new('ABC-123', @poll)
|
|
9
|
+
@request = EPP::Request.new(@command)
|
|
10
|
+
@xml = @request.to_xml
|
|
11
|
+
|
|
12
|
+
namespaces_from_request
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
should 'validate against schema' do
|
|
16
|
+
assert @xml.validate_schema(schema)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
should 'set clTRID' do
|
|
20
|
+
assert_equal 'ABC-123', xpath_find('//epp:clTRID')
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
should 'set op mode req' do
|
|
24
|
+
assert_equal 'req', xpath_find('//epp:poll/@op')
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
context 'ack' do
|
|
28
|
+
setup do
|
|
29
|
+
@poll = EPP::Commands::Poll.new('234629834')
|
|
30
|
+
@command = EPP::Requests::Command.new('ABC-123', @poll)
|
|
31
|
+
@request = EPP::Request.new(@command)
|
|
32
|
+
@xml = @request.to_xml
|
|
33
|
+
|
|
34
|
+
namespaces_from_request
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
should 'validate against schema' do
|
|
38
|
+
assert @xml.validate_schema(schema)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
should 'set clTRID' do
|
|
42
|
+
assert_equal 'ABC-123', xpath_find('//epp:clTRID')
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
should 'set op mode ack' do
|
|
46
|
+
assert_equal 'ack', xpath_find('//epp:poll/@op')
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
should 'set msgID' do
|
|
50
|
+
assert_equal '234629834', xpath_find('//epp:poll/@msgID')
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestEppRenewCommand < Test::Unit::TestCase
|
|
4
|
+
context 'EPP::Commands::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
|
+
end
|
|
@@ -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,88 @@
|
|
|
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 'have ids' do
|
|
24
|
+
expected = ['sh8013', 'sah8013', '8013sah'].sort
|
|
25
|
+
assert_equal expected, @check_response.ids.sort
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
should 'have count' do
|
|
29
|
+
assert_equal 3, @check_response.count
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
should 'list sh8013 as available' do
|
|
33
|
+
assert @check_response.available?('sh8013')
|
|
34
|
+
assert !@check_response.unavailable?('sh8013')
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
should 'list sah8013 as unavailable' do
|
|
38
|
+
assert @check_response.unavailable?('sah8013')
|
|
39
|
+
assert !@check_response.available?('sah8013')
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
should 'list 8013sah as available' do
|
|
43
|
+
assert @check_response.available?('8013sah')
|
|
44
|
+
assert !@check_response.unavailable?('8013sah')
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
should 'raise ArgumentError if available with no argument for count > 1' do
|
|
48
|
+
assert_raise ArgumentError do
|
|
49
|
+
@check_response.available?
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
should 'raise RuntimeError if id called with count > 1' do
|
|
54
|
+
assert_raise RuntimeError do
|
|
55
|
+
@check_response.id
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
context 'EPP::Contact::CheckResponse Single Query' do
|
|
61
|
+
setup do
|
|
62
|
+
@response = EPP::Response.new(load_xml('contact/check-single'))
|
|
63
|
+
@check_response = EPP::Contact::CheckResponse.new(@response)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
should 'have names' do
|
|
67
|
+
assert_equal ['sh8013'], @check_response.ids
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
should 'have name' do
|
|
71
|
+
assert_equal 'sh8013', @check_response.id
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
should 'have count' do
|
|
75
|
+
assert_equal 1, @check_response.count
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
should 'list sh8013 as available' do
|
|
79
|
+
assert @check_response.available?('sh8013')
|
|
80
|
+
assert !@check_response.unavailable?('sh8013')
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
should 'be available? with no argument' do
|
|
84
|
+
assert @check_response.available?
|
|
85
|
+
assert !@check_response.unavailable?
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|