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,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
3
|
+
<response>
|
4
|
+
<result code="1000">
|
5
|
+
<msg>Command completed successfully</msg>
|
6
|
+
</result>
|
7
|
+
<resData>
|
8
|
+
<host:creData
|
9
|
+
xmlns:host="urn:ietf:params:xml:ns:host-1.0">
|
10
|
+
<host:name>ns1.example.com</host:name>
|
11
|
+
<host:crDate>1999-04-03T22:00:00.0Z</host:crDate>
|
12
|
+
</host:creData>
|
13
|
+
</resData>
|
14
|
+
<trID>
|
15
|
+
<clTRID>ABC-12345</clTRID>
|
16
|
+
<svTRID>54322-XYZ</svTRID>
|
17
|
+
</trID>
|
18
|
+
</response>
|
19
|
+
</epp>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
3
|
+
<response>
|
4
|
+
<result code="1000">
|
5
|
+
<msg>Command completed successfully</msg>
|
6
|
+
</result>
|
7
|
+
<trID>
|
8
|
+
<clTRID>ABC-12345</clTRID>
|
9
|
+
<svTRID>54321-XYZ</svTRID>
|
10
|
+
</trID>
|
11
|
+
</response>
|
12
|
+
</epp>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
3
|
+
<response>
|
4
|
+
<result code="1000">
|
5
|
+
<msg>Command completed successfully</msg>
|
6
|
+
</result>
|
7
|
+
<resData>
|
8
|
+
<host:infData
|
9
|
+
xmlns:host="urn:ietf:params:xml:ns:host-1.0">
|
10
|
+
<host:name>ns1.example.com</host:name>
|
11
|
+
<host:roid>NS1_EXAMPLE1-REP</host:roid>
|
12
|
+
<host:status s="linked"/>
|
13
|
+
<host:status s="clientUpdateProhibited"/>
|
14
|
+
<host:addr ip="v4">192.0.2.2</host:addr>
|
15
|
+
<host:addr ip="v4">192.0.2.29</host:addr>
|
16
|
+
<host:addr ip="v6">1080:0:0:0:8:800:200C:417A</host:addr>
|
17
|
+
<host:clID>ClientY</host:clID>
|
18
|
+
<host:crID>ClientX</host:crID>
|
19
|
+
<host:crDate>1999-04-03T22:00:00.0Z</host:crDate>
|
20
|
+
<host:upID>ClientX</host:upID>
|
21
|
+
<host:upDate>1999-12-03T09:00:00.0Z</host:upDate>
|
22
|
+
<host:trDate>2000-04-08T09:00:00.0Z</host:trDate>
|
23
|
+
</host:infData>
|
24
|
+
</resData>
|
25
|
+
<trID>
|
26
|
+
<clTRID>ABC-12345</clTRID>
|
27
|
+
<svTRID>54322-XYZ</svTRID>
|
28
|
+
</trID>
|
29
|
+
</response>
|
30
|
+
</epp>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
3
|
+
<response>
|
4
|
+
<result code="1000">
|
5
|
+
<msg>Command completed successfully</msg>
|
6
|
+
</result>
|
7
|
+
<trID>
|
8
|
+
<clTRID>ABC-12345</clTRID>
|
9
|
+
<svTRID>54321-XYZ</svTRID>
|
10
|
+
</trID>
|
11
|
+
</response>
|
12
|
+
</epp>
|
data/test/helper.rb
CHANGED
@@ -1,10 +1,99 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'test/unit'
|
3
3
|
require 'shoulda'
|
4
|
+
require 'mocha/setup'
|
5
|
+
|
6
|
+
if RUBY_VERSION >= '1.9'
|
7
|
+
begin
|
8
|
+
require 'simplecov'
|
9
|
+
rescue LoadError
|
10
|
+
puts "Coverage results will not be available during this build"
|
11
|
+
end
|
12
|
+
end
|
4
13
|
|
5
14
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
15
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
7
16
|
require 'epp-client'
|
8
17
|
|
18
|
+
# Load EVERYTHING so SimpleCov works
|
19
|
+
EPP::constants.each do |constant|
|
20
|
+
konstant = EPP::const_get(constant)
|
21
|
+
case konstant
|
22
|
+
when Class, Module
|
23
|
+
konstant::constants.each do |k2|
|
24
|
+
konstant::const_get(k2)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
9
29
|
class Test::Unit::TestCase
|
30
|
+
def stub_getaddrinfo!(host = 'epp.test.host', port = 700)
|
31
|
+
host ||= 'epp.test.host'
|
32
|
+
port ||= 700
|
33
|
+
|
34
|
+
addrinfo = [["AF_INET", port, "198.51.100.53", "198.51.100.53", 2, 1, 6]]
|
35
|
+
Socket.expects(:getaddrinfo).with(host, port, nil, Socket::SOCK_STREAM).returns(addrinfo).at_least_once
|
36
|
+
end
|
37
|
+
def load_xml(name)
|
38
|
+
xml_path = File.expand_path("../fixtures/responses/#{name}.xml", __FILE__)
|
39
|
+
File.read(xml_path)
|
40
|
+
end
|
41
|
+
def load_schema(name)
|
42
|
+
xsd_path = File.expand_path("../support/schemas/#{name}.xsd", __FILE__)
|
43
|
+
xsd_doc = XML::Document.file(xsd_path)
|
44
|
+
XML::Schema.document(xsd_doc)
|
45
|
+
end
|
46
|
+
def schema
|
47
|
+
@schema ||= load_schema('all')
|
48
|
+
end
|
49
|
+
def xpath_find(query)
|
50
|
+
n = @xml.find(query, @namespaces).first
|
51
|
+
case n
|
52
|
+
when XML::Node
|
53
|
+
n.content.strip
|
54
|
+
when XML::Attr
|
55
|
+
n.value.strip
|
56
|
+
end
|
57
|
+
end
|
58
|
+
def xpath_each(query)
|
59
|
+
@xml.find(query, @namespaces).each do |node|
|
60
|
+
yield node
|
61
|
+
end
|
62
|
+
end
|
63
|
+
def xpath_exists?(query)
|
64
|
+
!@xml.find(query, @namespaces).empty?
|
65
|
+
end
|
66
|
+
def namespaces_from_request(request = @request)
|
67
|
+
@namespaces = Hash[*request.namespaces.map { |k,ns| [k, ns.href] }.flatten]
|
68
|
+
end
|
69
|
+
|
70
|
+
unless RUBY_VERSION >= "1.9"
|
71
|
+
def assert_output stdout = nil, stderr = nil
|
72
|
+
out, err = capture_io do
|
73
|
+
yield
|
74
|
+
end
|
75
|
+
|
76
|
+
stdout_matcher = stdout.is_a?(Regexp) ? method(:assert_match) : method(:assert_equal)
|
77
|
+
stderr_matcher = stderr.is_a?(Regexp) ? method(:assert_match) : method(:assert_equal)
|
78
|
+
|
79
|
+
x = stdout_matcher.call(stdout, out, "In stdout") if stdout
|
80
|
+
y = stderr_matcher.call(stderr, err, "In stderr") if stderr
|
81
|
+
|
82
|
+
(!stdout || x) && (!stderr || y)
|
83
|
+
end
|
84
|
+
def capture_io
|
85
|
+
require 'stringio'
|
86
|
+
|
87
|
+
orig_stdout, orig_stderr = $stdout, $stderr
|
88
|
+
captured_stdout, captured_stderr = StringIO.new, StringIO.new
|
89
|
+
$stdout, $stderr = captured_stdout, captured_stderr
|
90
|
+
|
91
|
+
yield
|
92
|
+
|
93
|
+
return captured_stdout.string, captured_stderr.string
|
94
|
+
ensure
|
95
|
+
$stdout = orig_stdout
|
96
|
+
$stderr = orig_stderr
|
97
|
+
end
|
98
|
+
end
|
10
99
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEppHostCheckCommand < Test::Unit::TestCase
|
4
|
+
context 'EPP::Host::Check' do
|
5
|
+
setup do
|
6
|
+
@host_check = EPP::Host::Check.new('ns1.example.com', 'ns2.example.com')
|
7
|
+
|
8
|
+
@check = EPP::Commands::Check.new(@host_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('//host:name') do |node|
|
27
|
+
names << node.content.strip
|
28
|
+
end
|
29
|
+
|
30
|
+
assert_equal %w(ns1.example.com ns2.example.com), names
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEppHostCheckResponse < Test::Unit::TestCase
|
4
|
+
context 'EPP::Host::CheckResponse' do
|
5
|
+
setup do
|
6
|
+
@response = EPP::Response.new(load_xml('host/check'))
|
7
|
+
@check_response = EPP::Host::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 ns1.example.com as available' do
|
24
|
+
assert @check_response.available?('ns1.example.com')
|
25
|
+
assert !@check_response.unavailable?('ns1.example.com')
|
26
|
+
end
|
27
|
+
|
28
|
+
should 'list ns2.exampl2.com as unavailable' do
|
29
|
+
assert @check_response.unavailable?('ns2.example2.com')
|
30
|
+
assert !@check_response.available?('ns2.example2.com')
|
31
|
+
end
|
32
|
+
|
33
|
+
should 'list ns3.example3.com as available' do
|
34
|
+
assert @check_response.available?('ns3.example3.com')
|
35
|
+
assert !@check_response.unavailable?('ns3.example3.com')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEppHostCreateCommand < Test::Unit::TestCase
|
4
|
+
context 'EPP::Host::Create' do
|
5
|
+
setup do
|
6
|
+
@host_create = EPP::Host::Create.new('ns1.example.com',
|
7
|
+
:ipv4 => "198.51.100.53", :ipv6 => "2001:db8::53:1")
|
8
|
+
|
9
|
+
@create = EPP::Commands::Create.new(@host_create)
|
10
|
+
@command = EPP::Requests::Command.new('ABC-123', @create)
|
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 ns1.example.com as name' do
|
26
|
+
assert_equal 'ns1.example.com', xpath_find('//host:name')
|
27
|
+
end
|
28
|
+
|
29
|
+
should 'set IPv4 address' do
|
30
|
+
assert_equal "198.51.100.53", xpath_find('//host:addr[@ip="v4"]')
|
31
|
+
end
|
32
|
+
|
33
|
+
should 'set IPv6 address' do
|
34
|
+
assert_equal "2001:db8::53:1", xpath_find('//host:addr[@ip="v6"]')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEppHostCreateResponse < Test::Unit::TestCase
|
4
|
+
context 'EPP::Host::CreateResponse' do
|
5
|
+
setup do
|
6
|
+
@response = EPP::Response.new(load_xml('host/create'))
|
7
|
+
@create_response = EPP::Host::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 ns1.example.com' do
|
24
|
+
assert_equal 'ns1.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
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEppHostDeleteCommand < Test::Unit::TestCase
|
4
|
+
context 'EPP::Host::Delete' do
|
5
|
+
setup do
|
6
|
+
@host_info = EPP::Host::Delete.new('ns1.example.com')
|
7
|
+
|
8
|
+
@info = EPP::Commands::Delete.new(@host_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 ns1.example.com as name' do
|
25
|
+
assert_equal 'ns1.example.com', xpath_find('//host:name')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEppHostDeleteResponse < Test::Unit::TestCase
|
4
|
+
context 'EPP::Host::DeleteResponse' do
|
5
|
+
setup do
|
6
|
+
@response = EPP::Response.new(load_xml('host/delete'))
|
7
|
+
@delete_response = EPP::Host::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 TestEppHostInfoCommand < Test::Unit::TestCase
|
4
|
+
context 'EPP::Host::Info' do
|
5
|
+
setup do
|
6
|
+
@host_info = EPP::Host::Info.new('ns1.example.com')
|
7
|
+
|
8
|
+
@info = EPP::Commands::Info.new(@host_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 ns1.example.com as name' do
|
25
|
+
assert_equal 'ns1.example.com', xpath_find('//host:name')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEppHostInfoResponse < Test::Unit::TestCase
|
4
|
+
context 'EPP::Host::InfoResponse' do
|
5
|
+
setup do
|
6
|
+
@response = EPP::Response.new(load_xml('host/info'))
|
7
|
+
@info_response = EPP::Host::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 'ns1.example.com', @info_response.name
|
25
|
+
end
|
26
|
+
|
27
|
+
should 'have roid' do
|
28
|
+
assert_equal 'NS1_EXAMPLE1-REP', @info_response.roid
|
29
|
+
end
|
30
|
+
|
31
|
+
should 'have status' do
|
32
|
+
expected = %w(linked clientUpdateProhibited)
|
33
|
+
assert_equal expected, @info_response.status
|
34
|
+
end
|
35
|
+
|
36
|
+
should 'have addresses' do
|
37
|
+
expected = {'ipv4' => %w(192.0.2.2 192.0.2.29),
|
38
|
+
'ipv6' => %w(1080:0:0:0:8:800:200C:417A)}
|
39
|
+
assert_equal expected, @info_response.addresses
|
40
|
+
end
|
41
|
+
|
42
|
+
should 'have client_id' do
|
43
|
+
assert_equal 'ClientY', @info_response.client_id
|
44
|
+
end
|
45
|
+
|
46
|
+
should 'have creator_id' do
|
47
|
+
assert_equal 'ClientX', @info_response.creator_id
|
48
|
+
end
|
49
|
+
|
50
|
+
should 'have created_date' do
|
51
|
+
# 1999-04-03T22:00:00.0Z
|
52
|
+
expected = Time.gm(1999,4,3,22,00,00)
|
53
|
+
assert_equal expected, @info_response.created_date
|
54
|
+
end
|
55
|
+
|
56
|
+
should 'have updator_id' do
|
57
|
+
assert_equal 'ClientX', @info_response.updator_id
|
58
|
+
end
|
59
|
+
|
60
|
+
should 'have updated_date' do
|
61
|
+
# 1999-12-03T09:00:00.0Z
|
62
|
+
expected = Time.gm(1999,12,3,9,00,00)
|
63
|
+
assert_equal expected, @info_response.updated_date
|
64
|
+
end
|
65
|
+
|
66
|
+
should 'have transfer_date' do
|
67
|
+
# 2000-04-08T09:00:00.0Z
|
68
|
+
expected = Time.gm(2000,4,8,9,00,00)
|
69
|
+
assert_equal expected, @info_response.transfer_date
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|