kono_epp_client 0.1.1 → 2.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.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -0
  3. data/Makefile +13 -0
  4. data/README.md +20 -3
  5. data/kono_epp_client.gemspec +4 -1
  6. data/lib/kono_epp_client/VERSION +1 -1
  7. data/lib/kono_epp_client/commands/check_contacts.rb +19 -0
  8. data/lib/{epp/epp_command/kono_epp_check_domains.rb → kono_epp_client/commands/check_domains.rb} +3 -1
  9. data/lib/kono_epp_client/commands/command.rb +15 -0
  10. data/lib/kono_epp_client/commands/create_contact.rb +89 -0
  11. data/lib/kono_epp_client/commands/create_domain.rb +56 -0
  12. data/lib/kono_epp_client/commands/delete_contact.rb +17 -0
  13. data/lib/kono_epp_client/commands/delete_domain.rb +16 -0
  14. data/lib/kono_epp_client/commands/hello.rb +15 -0
  15. data/lib/kono_epp_client/commands/info_contact.rb +17 -0
  16. data/lib/kono_epp_client/commands/info_domain.rb +16 -0
  17. data/lib/kono_epp_client/commands/login.rb +84 -0
  18. data/lib/kono_epp_client/commands/logout.rb +12 -0
  19. data/lib/kono_epp_client/commands/poll.rb +18 -0
  20. data/lib/kono_epp_client/commands/transfer_domain.rb +38 -0
  21. data/lib/kono_epp_client/commands/update_contact.rb +116 -0
  22. data/lib/kono_epp_client/commands/update_domain.rb +117 -0
  23. data/lib/kono_epp_client/dns_sec/add.rb +13 -0
  24. data/lib/kono_epp_client/dns_sec/ds_data.rb +65 -0
  25. data/lib/kono_epp_client/dns_sec/rem.rb +14 -0
  26. data/lib/kono_epp_client/dns_sec/rem_all.rb +10 -0
  27. data/lib/kono_epp_client/exceptions/error_response.rb +19 -0
  28. data/lib/kono_epp_client/exceptions.rb +15 -0
  29. data/lib/kono_epp_client/requires_parameters.rb +16 -0
  30. data/lib/{epp → kono_epp_client}/server.rb +63 -55
  31. data/lib/kono_epp_client.rb +4 -16
  32. data/spec/eager_load_spec.rb +6 -0
  33. data/spec/factories/ds_data.rb +12 -0
  34. data/spec/fixtures/dns_sec/add.xml +14 -0
  35. data/spec/fixtures/dns_sec/ds_data.xml +6 -0
  36. data/spec/fixtures/dns_sec/rem.xml +14 -0
  37. data/spec/fixtures/dns_sec/rem_all.xml +3 -0
  38. data/spec/fixtures/login_response.xml +23 -0
  39. data/spec/fixtures/login_response_for_dnssec.xml +25 -0
  40. data/spec/fixtures/snapshots/kono_epp_client/commands/create_domain/_create_with_ds_data_build_extensions.xml.snap +39 -0
  41. data/spec/fixtures/snapshots/kono_epp_client/commands/login/_login.xml.snap +7 -0
  42. data/spec/fixtures/snapshots/kono_epp_client/commands/login/_tags_extensions_with_value_xml.xml.snap +14 -0
  43. data/spec/fixtures/snapshots/kono_epp_client/commands/login/_tags_lang_with_value_xml.xml.snap +11 -0
  44. data/spec/fixtures/snapshots/kono_epp_client/commands/login/_tags_new_password_with_value_xml.xml.snap +9 -0
  45. data/spec/fixtures/snapshots/kono_epp_client/commands/login/_tags_services_with_value_xml.xml.snap +12 -0
  46. data/spec/fixtures/snapshots/kono_epp_client/commands/login/_tags_version_with_value_xml.xml.snap +11 -0
  47. data/spec/fixtures/snapshots/kono_epp_client/commands/login/_with_id_and_password_login.xml.snap +10 -0
  48. data/spec/fixtures/snapshots/kono_epp_client/commands/update_domain/_update_DnsSec_build_extensions.xml.snap +30 -0
  49. data/spec/{epp/epp_command/kono_epp_check_contacts_spec.rb → lib/commands/check_contacts_spec.rb} +1 -1
  50. data/spec/{epp/epp_command/kono_epp_check_domains_spec.rb → lib/commands/check_domains_spec.rb} +1 -1
  51. data/spec/{epp/kono_epp_command_spec.rb → lib/commands/command_spec.rb} +2 -2
  52. data/spec/lib/commands/create_domain_spec.rb +50 -0
  53. data/spec/lib/commands/login_spec.rb +87 -0
  54. data/spec/{epp/epp_command/kono_epp_transfer_domain_spec.rb → lib/commands/transfer_domain_spec.rb} +1 -1
  55. data/spec/{epp/epp_command/kono_epp_update_domain_spec.rb → lib/commands/update_domain_spec.rb} +20 -4
  56. data/spec/lib/dns_sec/add_spec.rb +14 -0
  57. data/spec/lib/dns_sec/ds_data_spec.rb +43 -0
  58. data/spec/lib/dns_sec/rem_all_spec.rb +11 -0
  59. data/spec/lib/dns_sec/rem_spec.rb +14 -0
  60. data/spec/lib/server_spec.rb +304 -0
  61. data/spec/spec_helper.rb +6 -2
  62. data/spec/support/context.rb +1 -1
  63. data/spec/support/factory_bot.rb +8 -0
  64. data/spec/support/fixtures.rb +16 -0
  65. data/spec/support/matchers.rb +14 -0
  66. data/spec/support/parametric.rb +1 -0
  67. data/spec/support/snapshot.rb +12 -2
  68. metadata +157 -60
  69. data/lib/epp/epp_command/check_contacts.rb +0 -17
  70. data/lib/epp/epp_command/create_contact.rb +0 -87
  71. data/lib/epp/epp_command/create_domain.rb +0 -44
  72. data/lib/epp/epp_command/delete_contact.rb +0 -15
  73. data/lib/epp/epp_command/delete_domain.rb +0 -14
  74. data/lib/epp/epp_command/hello.rb +0 -13
  75. data/lib/epp/epp_command/info_contact.rb +0 -15
  76. data/lib/epp/epp_command/info_domain.rb +0 -14
  77. data/lib/epp/epp_command/login.rb +0 -79
  78. data/lib/epp/epp_command/logout.rb +0 -10
  79. data/lib/epp/epp_command/poll.rb +0 -16
  80. data/lib/epp/epp_command/transfer_domain.rb +0 -36
  81. data/lib/epp/epp_command/update_contact.rb +0 -115
  82. data/lib/epp/epp_command/update_domain.rb +0 -104
  83. data/lib/epp/epp_command.rb +0 -15
  84. data/lib/epp/exceptions.rb +0 -28
  85. data/lib/epp/transport/tcp.rb +0 -93
  86. data/lib/require_parameters.rb +0 -14
  87. data/spec/epp/epp_command/kono_epp_create_domain_spec.rb +0 -37
  88. data/spec/epp/server_spec.rb +0 -69
  89. /data/lib/{epp/transport/http.rb → kono_epp_client/transport/http_transport.rb} +0 -0
  90. /data/lib/{epp → kono_epp_client}/transport.rb +0 -0
  91. /data/spec/fixtures/snapshots/{kono_epp_check_contacts → kono_epp_client/commands/check_contacts}/_construct.xml.snap +0 -0
  92. /data/spec/fixtures/snapshots/{kono_epp_check_domains → kono_epp_client/commands/check_domains}/_construct.xml.snap +0 -0
  93. /data/spec/fixtures/snapshots/{kono_epp_create_domain → kono_epp_client/commands/create_domain}/_create.xml.snap +0 -0
  94. /data/spec/fixtures/snapshots/{kono_epp_transfer_domain → kono_epp_client/commands/transfer_domain}/_con_extension_construct.xml.snap +0 -0
  95. /data/spec/fixtures/snapshots/{kono_epp_transfer_domain → kono_epp_client/commands/transfer_domain}/_construct.xml.snap +0 -0
  96. /data/spec/fixtures/snapshots/{kono_epp_update_domain → kono_epp_client/commands/update_domain}/_restore_esiste_l'estensione_di_restore.xml.snap +0 -0
  97. /data/spec/fixtures/snapshots/{kono_epp_update_domain → kono_epp_client/commands/update_domain}/_update_auth_info_cambia_AUTH_INFO.xml.snap +0 -0
  98. /data/spec/fixtures/snapshots/{kono_epp_update_domain → kono_epp_client/commands/update_domain}/_update_auth_info_con_nuovo_registrant_cambia_REGISTRANT.xml.snap +0 -0
  99. /data/spec/fixtures/snapshots/{kono_epp_update_domain → kono_epp_client/commands/update_domain}/_update_contacts_cambia_ADMIN_TECH.xml.snap +0 -0
  100. /data/spec/fixtures/snapshots/{kono_epp_update_domain → kono_epp_client/commands/update_domain}/_update_nameservers_aggiunge_e_rimuove_ns.xml.snap +0 -0
  101. /data/spec/fixtures/snapshots/{kono_epp_update_domain → kono_epp_client/commands/update_domain}/_update_status_cambia_status.xml.snap +0 -0
@@ -1,115 +0,0 @@
1
- class KonoEppUpdateContact < KonoEppCommand
2
-
3
- # TODO: Add and remove fields
4
- def initialize( options )
5
- super( nil, nil )
6
-
7
- command = root.elements['command']
8
-
9
- update = command.add_element "update"
10
-
11
- contact_update = update.add_element( "contact:update", { "xmlns:contact" => "urn:ietf:params:xml:ns:contact-1.0",
12
- "xsi:schemaLocation" => "urn:ietf:params:xml:ns:contact-1.0 contact-1.0.xsd" } )
13
-
14
- id = contact_update.add_element "contact:id"
15
- id.text = options[:id]
16
-
17
- contact_chg = contact_update.add_element "contact:chg"
18
-
19
- unless options[:name].blank? \
20
- and options[:organization].blank? \
21
- and options[:address].blank? \
22
- and options[:city].blank? \
23
- and options[:state].blank? \
24
- and options[:postal_code].blank? \
25
- and options[:country].blank?
26
-
27
- postal_info = contact_chg.add_element "contact:postalInfo", { "type" => "loc" }
28
-
29
- unless options[:name].blank?
30
- name = postal_info.add_element "contact:name"
31
- name.text = options[:name]
32
- end
33
-
34
- unless options[:organization].blank?
35
- organization = postal_info.add_element "contact:org"
36
- organization.text = options[:organization]
37
- end
38
-
39
- # NOTE: city and country are REQUIRED
40
- unless options[:address].blank? \
41
- and options[:city].blank? \
42
- and options[:state].blank? \
43
- and options[:postal_code].blank? \
44
- and options[:country].blank?
45
-
46
- addr = postal_info.add_element "contact:addr"
47
-
48
- unless options[:address].blank?
49
- street = addr.add_element "contact:street"
50
- street.text = options[:address]
51
- end
52
-
53
- city = addr.add_element "contact:city"
54
- city.text = options[:city]
55
-
56
- unless options[:state].blank?
57
- state = addr.add_element "contact:sp"
58
- state.text = options[:state]
59
- end
60
-
61
- unless options[:postal_code].blank?
62
- postal_code = addr.add_element "contact:pc"
63
- postal_code.text = options[:postal_code]
64
- end
65
-
66
- country_code = addr.add_element "contact:cc"
67
- country_code.text = options[:country]
68
- end
69
- end
70
-
71
- if options[:voice]
72
- voice = contact_chg.add_element "contact:voice"
73
- voice.text = options[:voice]
74
- end
75
-
76
- if options[:fax]
77
- fax = contact_chg.add_element "contact:fax"
78
- fax.text = options[:fax]
79
- end
80
-
81
- if options[:email]
82
- email = contact_chg.add_element "contact:email"
83
- email.text = options[:email]
84
- end
85
-
86
-
87
- unless not options.has_key?( :publish ) \
88
- and options[:nationality].blank? \
89
- and options[:entity_type].blank? \
90
- and options[:reg_code].blank?
91
-
92
- # FIXME
93
- extension = command.add_element "extension"
94
- extension_update = extension.add_element "extcon:update", { "xmlns:extcon" => 'http://www.nic.it/ITNIC-EPP/extcon-1.0',
95
- "xsi:schemaLocation" => 'http://www.nic.it/ITNIC-EPP/extcon-1.0 extcon-1.0.xsd' }
96
- if options.has_key?( :publish )
97
- publish = extension_update.add_element "extcon:consentForPublishing"
98
- publish.text = options[:publish]
99
- end
100
-
101
- if options[:becomes_registrant]
102
- extcon_registrant = extension_update.add_element "extcon:registrant"
103
-
104
- extcon_nationality = extcon_registrant.add_element "extcon:nationalityCode"
105
- extcon_nationality.text = options[:nationality]
106
-
107
- extcon_entity = extcon_registrant.add_element "extcon:entityType"
108
- extcon_entity.text = options[:entity_type]
109
-
110
- extcon_regcode = extcon_registrant.add_element "extcon:regCode"
111
- extcon_regcode.text = options[:reg_code]
112
- end
113
- end
114
- end
115
- end
@@ -1,104 +0,0 @@
1
- class KonoEppUpdateDomain < KonoEppCommand
2
- def initialize(options)
3
- super(nil, nil)
4
-
5
- command = root.elements['command']
6
- update = command.add_element("update")
7
-
8
- domain_update = update.add_element("domain:update", {"xmlns:domain" => "urn:ietf:params:xml:ns:domain-1.0",
9
- "xsi:schemaLocation" => "urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd"})
10
-
11
- name = domain_update.add_element "domain:name"
12
- name.text = options[:name]
13
-
14
- if not options[:add_nameservers].blank? or options[:add_admin] or options[:add_tech] or options[:add_status]
15
- # <domain:add>
16
- domain_add = domain_update.add_element "domain:add"
17
-
18
- unless options[:add_nameservers].blank?
19
- domain_add_ns = domain_add.add_element "domain:ns"
20
-
21
- options[:add_nameservers].each do |ns|
22
- host_attr = domain_add_ns.add_element "domain:hostAttr"
23
- host_name = host_attr.add_element "domain:hostName"
24
-
25
- host_name.text = ns[0]
26
-
27
- # FIXME IPv6
28
- if ns[1]
29
- host_addr = host_attr.add_element "domain:hostAddr", {"ip" => "v4"}
30
- host_addr.text = ns[1]
31
- end
32
- end
33
- end
34
-
35
- if options[:add_admin]
36
- domain_contact = domain_add.add_element "domain:contact", {"type" => "admin"}
37
- domain_contact.text = options[:add_admin]
38
- end
39
-
40
- if options[:add_status]
41
- domain_add.add_element "domain:status", {"s" => options[:add_status]}
42
- end
43
-
44
- if options[:add_tech]
45
- domain_contact = domain_add.add_element "domain:contact", {"type" => "tech"}
46
- domain_contact.text = options[:add_tech]
47
- end
48
- end
49
-
50
- if not options[:remove_nameservers].blank? or options[:remove_admin] or options[:remove_tech] or options[:remove_status]
51
- # <domain:rem>
52
- domain_remove = domain_update.add_element "domain:rem"
53
-
54
- unless options[:remove_nameservers].blank?
55
- domain_remove_ns = domain_remove.add_element "domain:ns"
56
-
57
- options[:remove_nameservers].each do |ns_name|
58
- host_attr = domain_remove_ns.add_element "domain:hostAttr"
59
- host_name = host_attr.add_element "domain:hostName"
60
-
61
- host_name.text = ns_name
62
- end
63
- end
64
-
65
- if options[:remove_admin]
66
- domain_contact = domain_remove.add_element "domain:contact", {"type" => "admin"}
67
- domain_contact.text = options[:remove_admin]
68
- end
69
-
70
- if options[:remove_status]
71
- domain_remove.add_element "domain:status", {"s" => options[:remove_status]}
72
- end
73
-
74
- if options[:remove_tech]
75
- domain_contact = domain_remove.add_element "domain:contact", {"type" => "tech"}
76
- domain_contact.text = options[:remove_tech]
77
- end
78
- end
79
-
80
- # <domain:chg>
81
- if options[:auth_info]
82
- domain_change = domain_update.add_element "domain:chg"
83
-
84
- if options[:registrant]
85
- domain_registrant = domain_change.add_element "domain:registrant"
86
- domain_registrant.text = options[:registrant]
87
- end
88
-
89
- domain_authinfo = domain_change.add_element "domain:authInfo"
90
-
91
- domain_pw = domain_authinfo.add_element "domain:pw"
92
- domain_pw.text = options[:auth_info]
93
- end
94
-
95
- if options[:restore]
96
- command.add_element("extension").tap do |ext|
97
- ext.add_element("rgp:update", {"xmlns:rgp"=>"urn:ietf:params:xml:ns:rgp-1.0",
98
- "xsi:schemaLocation"=>"urn:ietf:params:xml:ns:rgp-1.0 rgp-1.0.xsd"}).
99
- add_element("rgp:restore", {"op"=> "request"})
100
- end
101
- end
102
- # TODO: Registrant
103
- end
104
- end
@@ -1,15 +0,0 @@
1
- include REXML
2
-
3
- class KonoEppCommand < REXML::Document
4
- def initialize( source = nil, context = nil )
5
- super( source, context )
6
-
7
- add( XMLDecl.new( "1.0", "UTF-8", "no" ) )
8
-
9
- epp = add_element( "epp", { "xmlns" => "urn:ietf:params:xml:ns:epp-1.0",
10
- "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
11
- "xsi:schemaLocation" => "urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" } )
12
-
13
- epp.add_element( "command" )
14
- end
15
- end
@@ -1,28 +0,0 @@
1
- class KonoEppErrorResponse < StandardError #:nodoc:
2
- attr_accessor :response_xml, :response_code, :reason_code, :message
3
-
4
- # Generic EPP exception. Accepts a response code and a message
5
- def initialize(attributes = {})
6
- @response_xml = attributes[:xml]
7
- @response_code = attributes[:response_code]
8
- @reason_code = attributes[:reason_code]
9
- @message = attributes[:message]
10
- end
11
-
12
- def to_s
13
- "#{@message} (reason: #{@reason_code} code: #{@response_code})"
14
- end
15
- end
16
-
17
- class KonoEppAuthenticationPasswordExpired < KonoEppErrorResponse ; end
18
- class KonoEppLoginNeeded < KonoEppErrorResponse ; end
19
-
20
- ##
21
- # Errore NIC:
22
- # 2304=Object status prohibits operation 9022=Domain has status clientTransferProhibited
23
- class KonoEppDomainHasStatusCliTransProhibited < KonoEppErrorResponse; end
24
-
25
- ##
26
- # Errore NIC:
27
- # 2304=Object status prohibits operation 9026=Domain has status clientUpdateProhibited
28
- class KonoEppDomainHasStatusClientUpdateProhibited < KonoEppErrorResponse; end
@@ -1,93 +0,0 @@
1
- module KonoEppClient::Transport
2
- class TcpTransport
3
- include KonoEppClient::Transport
4
-
5
- def initialize( server, port )
6
- @connection = TCPSocket.new( server, port )
7
- @socket = OpenSSL::SSL::SSLSocket.new( @connection )
8
-
9
- # Synchronously close the connection & socket
10
- @socket.sync_close
11
-
12
- # Connect
13
- @socket.connect
14
-
15
- # Get the initial frame
16
- read
17
- end
18
-
19
- def read
20
- if old_server
21
- data = ""
22
- first_char = @socket.read(1)
23
-
24
- if first_char.nil? and @socket.eof?
25
- raise SocketError.new("Connection closed by remote server")
26
- elsif first_char.nil?
27
- raise SocketError.new("Error reading frame from remote server")
28
- else
29
- data << first_char
30
-
31
- while char = @socket.read(1)
32
- data << char
33
-
34
- return data if data =~ %r|<\/epp>\n$|mi # at end
35
- end
36
- end
37
- else
38
- header = @socket.read(4)
39
-
40
- if header.nil? and @socket.eof?
41
- raise SocketError.new("Connection closed by remote server")
42
- elsif header.nil?
43
- raise SocketError.new("Error reading frame from remote server")
44
- else
45
- unpacked_header = header.unpack("N")
46
- length = unpacked_header[0]
47
-
48
- if length < 5
49
- raise SocketError.new("Got bad frame header length of #{length} bytes from the server")
50
- else
51
- response = @socket.read(length - 4)
52
- end
53
- end
54
- end
55
- end
56
-
57
- def write
58
- if defined?( @socket ) and @socket.is_a?( OpenSSL::SSL::SSLSocket )
59
- @socket.close
60
- @socket = nil
61
- end
62
-
63
- if defined?( @connection ) and @connection.is_a?( TCPSocket )
64
- @connection.close
65
- @connection = nil
66
- end
67
-
68
- return true if @connection.nil? and @socket.nil?
69
- end
70
-
71
- def close
72
- if defined?( @socket ) and @socket.is_a?( OpenSSL::SSL::SSLSocket )
73
- @socket.close
74
- @socket = nil
75
- end
76
-
77
- if defined?( @connection ) and @connection.is_a?( TCPSocket )
78
- @connection.close
79
- @connection = nil
80
- end
81
-
82
- return true if @connection.nil? and @socket.nil?
83
- end
84
- private
85
- # Receive an EPP frame from the server. Since the connection is blocking,
86
- # this method will wait until the connection becomes available for use. If
87
- # the connection is broken, a SocketError will be raised. Otherwise,
88
- # it will return a string containing the XML from the server.
89
- def get_frame
90
- end
91
-
92
- end
93
- end
@@ -1,14 +0,0 @@
1
- module RequiresParameters #:nodoc:
2
- def requires!(hash, *params)
3
- params.each do |param|
4
- if param.is_a?(Array)
5
- raise ArgumentError.new("Missing required parameter: #{param.first}") unless hash.has_key?(param.first)
6
-
7
- valid_options = param[1..-1]
8
- raise ArgumentError.new("Parameter: #{param.first} must be one of #{valid_options.to_sentence(:connector => 'or')}") unless valid_options.include?(hash[param.first])
9
- else
10
- raise ArgumentError.new("Missing required parameter: #{param}") unless hash.has_key?(param)
11
- end
12
- end
13
- end
14
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe KonoEppCreateDomain do
4
- include_context "like epp command"
5
-
6
- let(:instance) {
7
- KonoEppCreateDomain.new(
8
- {name: 'architest.it',
9
- period: 1,
10
- nameservers:
11
- [["ns.test.it", "192.168.100.10"],
12
- ["ns2.test.it", "192.168.100.20"],
13
- ["ns3.foo.com"]],
14
- # contacts
15
- registrant: "RRR12",
16
- admin: "AAAA12",
17
- tech: "TTT12",
18
- authinfo: "WWW-test-it"
19
- }
20
- )
21
- }
22
-
23
- it "create", snapshot: "xml" do
24
- expect(rendered.to_s).to have_tag("ns")
25
- expect(rendered.to_s.downcase).to have_tag("hostattr")
26
- expect(rendered.to_s.downcase).to have_tag("ns hostattr" ) do
27
- with_tag("hostname",text:"ns2.test.it")
28
- with_tag("hostaddr",text:"192.168.100.20",with:{ip:"v4"})
29
- end
30
- expect(rendered.to_s.downcase).to have_tag("ns hostattr" ) do
31
- with_tag("hostname",text:"ns.test.it")
32
- with_tag("hostaddr",text:"192.168.100.10",with:{ip:"v4"})
33
- end
34
- expect(rendered.to_s.downcase).not_to have_tag("ns hostaddr", with: {ip: 'v4'},text:"" )
35
- end
36
-
37
- end
@@ -1,69 +0,0 @@
1
- RSpec.describe KonoEppClient::Server do
2
-
3
- let(:params) {
4
- {
5
- tag: "abc",
6
- password: "123123",
7
- server: "epp.pubtest.nic.it"
8
- }
9
- }
10
-
11
- let(:instance) { described_class.new(params) }
12
-
13
- describe "initialization" do
14
-
15
- it "base" do
16
- expect(instance).to have_attributes(
17
- **params,
18
- port: 700,
19
- old_server: false,
20
- lang: "en",
21
- services: ["urn:ietf:params:xml:ns:domain-1.0", "urn:ietf:params:xml:ns:contact-1.0", "urn:ietf:params:xml:ns:host-1.0"],
22
- extensions: [],
23
- version: "1.0",
24
- transport: :tcp,
25
- transport_options: {},
26
- timeout: 30,
27
- ssl_version: :TLSv1
28
- )
29
- end
30
- end
31
-
32
- describe "#open_connection" do
33
-
34
- it "default transport" do
35
-
36
- double = instance_double(KonoEppClient::Transport::TcpTransport)
37
-
38
- expect(KonoEppClient::Transport::TcpTransport).to receive(:new).with(params[:server], 700).and_return(double)
39
-
40
- expect { instance.open_connection }.to change { instance.instance_variable_get(:@connection) }.
41
- to(double)
42
- end
43
-
44
- context "transport http" do
45
-
46
- let(:params) {
47
- super().merge(
48
- transport: :http,
49
- transport_options: {cookie_file: "file_to_coockies"},
50
- )
51
- }
52
-
53
- it "use http transport" do
54
- double = instance_double(KonoEppClient::Transport::HttpTransport)
55
-
56
- expect(KonoEppClient::Transport::HttpTransport).to receive(:new).with(
57
- params[:server],
58
- 700, ssl_version: :TLSv1, cookie_file: "file_to_coockies").and_return(double)
59
-
60
- expect { instance.open_connection }.to change { instance.instance_variable_get(:@connection) }.
61
- to(double)
62
-
63
- end
64
-
65
- end
66
-
67
- end
68
-
69
- end
File without changes