savon 2.12.0 → 2.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +115 -77
- data/README.md +23 -21
- data/lib/savon/block_interface.rb +1 -0
- data/lib/savon/builder.rb +100 -30
- data/lib/savon/client.rb +1 -0
- data/lib/savon/header.rb +2 -6
- data/lib/savon/http_error.rb +4 -4
- data/lib/savon/log_message.rb +1 -0
- data/lib/savon/message.rb +1 -0
- data/lib/savon/mock/expectation.rb +1 -0
- data/lib/savon/mock/spec_helper.rb +1 -0
- data/lib/savon/mock.rb +1 -0
- data/lib/savon/model.rb +4 -3
- data/lib/savon/operation.rb +20 -18
- data/lib/savon/options.rb +57 -1
- data/lib/savon/qualified_message.rb +4 -3
- data/lib/savon/request.rb +5 -0
- data/lib/savon/request_logger.rb +8 -2
- data/lib/savon/response.rb +51 -4
- data/lib/savon/soap_fault.rb +2 -1
- data/lib/savon/string_utils.rb +17 -0
- data/lib/savon/version.rb +2 -1
- data/lib/savon.rb +2 -0
- metadata +78 -101
- data/.gitignore +0 -14
- data/.travis.yml +0 -18
- data/.yardopts +0 -6
- data/CONTRIBUTING.md +0 -46
- data/Gemfile +0 -13
- data/donate.png +0 -0
- data/lib/savon/core_ext/string.rb +0 -29
- data/savon.gemspec +0 -46
- data/spec/fixtures/gzip/message.gz +0 -0
- data/spec/fixtures/response/another_soap_fault.xml +0 -14
- data/spec/fixtures/response/authentication.xml +0 -14
- data/spec/fixtures/response/f5.xml +0 -39
- data/spec/fixtures/response/header.xml +0 -13
- data/spec/fixtures/response/list.xml +0 -18
- data/spec/fixtures/response/multi_ref.xml +0 -39
- data/spec/fixtures/response/no_body.xml +0 -1
- data/spec/fixtures/response/soap_fault.xml +0 -8
- data/spec/fixtures/response/soap_fault12.xml +0 -18
- data/spec/fixtures/response/soap_fault_funky.xml +0 -8
- data/spec/fixtures/response/taxcloud.xml +0 -1
- data/spec/fixtures/ssl/client_cert.pem +0 -16
- data/spec/fixtures/ssl/client_encrypted_key.pem +0 -30
- data/spec/fixtures/ssl/client_encrypted_key_cert.pem +0 -24
- data/spec/fixtures/ssl/client_key.pem +0 -15
- data/spec/fixtures/wsdl/authentication.xml +0 -63
- data/spec/fixtures/wsdl/betfair.xml +0 -2981
- data/spec/fixtures/wsdl/brand.xml +0 -624
- data/spec/fixtures/wsdl/edialog.xml +0 -15416
- data/spec/fixtures/wsdl/interhome.xml +0 -2137
- data/spec/fixtures/wsdl/lower_camel.xml +0 -52
- data/spec/fixtures/wsdl/multiple_namespaces.xml +0 -92
- data/spec/fixtures/wsdl/multiple_types.xml +0 -60
- data/spec/fixtures/wsdl/no_message_tag.xml +0 -1267
- data/spec/fixtures/wsdl/taxcloud.xml +0 -934
- data/spec/fixtures/wsdl/team_software.xml +0 -1
- data/spec/fixtures/wsdl/vies.xml +0 -176
- data/spec/fixtures/wsdl/wasmuth.xml +0 -153
- data/spec/integration/centra_spec.rb +0 -67
- data/spec/integration/email_example_spec.rb +0 -32
- data/spec/integration/random_quote_spec.rb +0 -23
- data/spec/integration/ratp_example_spec.rb +0 -28
- data/spec/integration/stockquote_example_spec.rb +0 -34
- data/spec/integration/support/application.rb +0 -82
- data/spec/integration/support/server.rb +0 -84
- data/spec/integration/temperature_example_spec.rb +0 -46
- data/spec/integration/zipcode_example_spec.rb +0 -42
- data/spec/savon/builder_spec.rb +0 -137
- data/spec/savon/client_spec.rb +0 -271
- data/spec/savon/core_ext/string_spec.rb +0 -37
- data/spec/savon/features/message_tag_spec.rb +0 -61
- data/spec/savon/http_error_spec.rb +0 -49
- data/spec/savon/log_message_spec.rb +0 -50
- data/spec/savon/message_spec.rb +0 -70
- data/spec/savon/mock_spec.rb +0 -174
- data/spec/savon/model_spec.rb +0 -182
- data/spec/savon/observers_spec.rb +0 -92
- data/spec/savon/operation_spec.rb +0 -230
- data/spec/savon/options_spec.rb +0 -1104
- data/spec/savon/qualified_message_spec.rb +0 -101
- data/spec/savon/request_logger_spec.rb +0 -37
- data/spec/savon/request_spec.rb +0 -540
- data/spec/savon/response_spec.rb +0 -275
- data/spec/savon/soap_fault_spec.rb +0 -136
- data/spec/savon/softlayer_spec.rb +0 -27
- data/spec/spec_helper.rb +0 -30
- data/spec/support/adapters.rb +0 -48
- data/spec/support/endpoint.rb +0 -25
- data/spec/support/fixture.rb +0 -39
- data/spec/support/integration.rb +0 -9
- data/spec/support/stdout.rb +0 -25
@@ -1,101 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
module Savon
|
4
|
-
describe QualifiedMessage, "#to_hash" do
|
5
|
-
|
6
|
-
context "if a key ends with !" do
|
7
|
-
let(:used_namespaces) { {} }
|
8
|
-
let(:key_converter) { :camelcase }
|
9
|
-
let(:types) { {} }
|
10
|
-
|
11
|
-
it "restores the ! in a key" do
|
12
|
-
message = described_class.new(types, used_namespaces, key_converter)
|
13
|
-
resulting_hash = message.to_hash({:Metal! => "<Nice/>"}, ["Rock"])
|
14
|
-
|
15
|
-
expect(resulting_hash).to eq({ :Metal! => "<Nice/>" })
|
16
|
-
end
|
17
|
-
|
18
|
-
it "properly handles special keys when namespaces are present" do
|
19
|
-
used_namespaces = {
|
20
|
-
%w(tns Foo) => 'ns',
|
21
|
-
%w(tns Foo Bar) => 'ns'
|
22
|
-
}
|
23
|
-
|
24
|
-
hash = {
|
25
|
-
:foo => {
|
26
|
-
:bar => {
|
27
|
-
:zing => 'pow'
|
28
|
-
},
|
29
|
-
:cash => {
|
30
|
-
:@attr1 => 'val1',
|
31
|
-
:content! => 'Chunky Bacon'
|
32
|
-
},
|
33
|
-
:attributes! => {
|
34
|
-
:bar => { :attr2 => 'val2' },
|
35
|
-
},
|
36
|
-
:"self_closing/" => '',
|
37
|
-
:order! => [:cash, :bar, :"self_closing/"]
|
38
|
-
}
|
39
|
-
}
|
40
|
-
|
41
|
-
good_result = {
|
42
|
-
"ns:Foo" => {
|
43
|
-
'ns:Bar' => { :zing => "pow" },
|
44
|
-
:cash => {
|
45
|
-
:@attr1 => "val1",
|
46
|
-
:content! => "Chunky Bacon"
|
47
|
-
},
|
48
|
-
:attributes! => {
|
49
|
-
'ns:Bar' => { :attr2 => 'val2' }
|
50
|
-
},
|
51
|
-
:"self_closing/" => '',
|
52
|
-
:order! => [:cash, 'ns:Bar', :"self_closing/"]
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
good_xml = %(<ns:Foo><Cash attr1="val1">Chunky Bacon</Cash><ns:Bar attr2="val2"><Zing>pow</Zing></ns:Bar><SelfClosing/></ns:Foo>)
|
57
|
-
|
58
|
-
message = described_class.new(types, used_namespaces, key_converter)
|
59
|
-
resulting_hash = message.to_hash(hash, ['tns'])
|
60
|
-
xml = Gyoku.xml(resulting_hash, key_converter: key_converter)
|
61
|
-
|
62
|
-
expect(resulting_hash).to eq good_result
|
63
|
-
expect(xml).to eq good_xml
|
64
|
-
end
|
65
|
-
|
66
|
-
it "properly handles boolean false" do
|
67
|
-
used_namespaces = {
|
68
|
-
%w(tns Foo) => 'ns'
|
69
|
-
}
|
70
|
-
|
71
|
-
hash = {
|
72
|
-
:foo => {
|
73
|
-
:falsey => {
|
74
|
-
:@attr1 => false,
|
75
|
-
:content! => false
|
76
|
-
}
|
77
|
-
}
|
78
|
-
}
|
79
|
-
|
80
|
-
good_result = {
|
81
|
-
"ns:Foo" => {
|
82
|
-
:falsey => {
|
83
|
-
:@attr1 => false,
|
84
|
-
:content! => false
|
85
|
-
}
|
86
|
-
}
|
87
|
-
}
|
88
|
-
|
89
|
-
good_xml = %(<ns:Foo><Falsey attr1="false">false</Falsey></ns:Foo>)
|
90
|
-
|
91
|
-
message = described_class.new(types, used_namespaces, key_converter)
|
92
|
-
resulting_hash = message.to_hash(hash, ['tns'])
|
93
|
-
xml = Gyoku.xml(resulting_hash, key_converter: key_converter)
|
94
|
-
|
95
|
-
expect(resulting_hash).to eq good_result
|
96
|
-
expect(xml).to eq good_xml
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
end
|
101
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Savon::RequestLogger do
|
4
|
-
|
5
|
-
subject { described_class.new(globals) }
|
6
|
-
let(:globals) { Savon::GlobalOptions.new(:log => true, :pretty_print_xml => true) }
|
7
|
-
let(:request) {
|
8
|
-
stub('Request',
|
9
|
-
:url => 'http://example.com',
|
10
|
-
:headers => [],
|
11
|
-
:body => '<TestRequest />'
|
12
|
-
)
|
13
|
-
}
|
14
|
-
|
15
|
-
let(:response) {
|
16
|
-
stub('Response',
|
17
|
-
:code => 200,
|
18
|
-
:body => '<TestResponse />'
|
19
|
-
)
|
20
|
-
}
|
21
|
-
|
22
|
-
before(:each) {
|
23
|
-
globals[:logger].level = Logger::DEBUG
|
24
|
-
}
|
25
|
-
|
26
|
-
describe '#log_request / #log_response' do
|
27
|
-
it 'does not prepare log messages when no logging is needed' do
|
28
|
-
begin
|
29
|
-
globals[:logger].level = Logger::FATAL
|
30
|
-
|
31
|
-
Savon::LogMessage.expects(:new).never
|
32
|
-
subject.log(request) { response }
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
data/spec/savon/request_spec.rb
DELETED
@@ -1,540 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "integration/support/server"
|
3
|
-
|
4
|
-
describe Savon::WSDLRequest do
|
5
|
-
|
6
|
-
let(:globals) { Savon::GlobalOptions.new }
|
7
|
-
let(:http_request) { HTTPI::Request.new }
|
8
|
-
let(:ciphers) { OpenSSL::Cipher.ciphers }
|
9
|
-
|
10
|
-
def new_wsdl_request
|
11
|
-
Savon::WSDLRequest.new(globals, http_request)
|
12
|
-
end
|
13
|
-
|
14
|
-
describe "#build" do
|
15
|
-
it "returns an HTTPI::Request" do
|
16
|
-
wsdl_request = Savon::WSDLRequest.new(globals)
|
17
|
-
expect(wsdl_request.build).to be_an(HTTPI::Request)
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "headers" do
|
21
|
-
it "are set when specified" do
|
22
|
-
globals.headers("Proxy-Authorization" => "Basic auth")
|
23
|
-
configured_http_request = new_wsdl_request.build
|
24
|
-
|
25
|
-
expect(configured_http_request.headers["Proxy-Authorization"]).to eq("Basic auth")
|
26
|
-
end
|
27
|
-
|
28
|
-
it "are not set otherwise" do
|
29
|
-
configured_http_request = new_wsdl_request.build
|
30
|
-
expect(configured_http_request.headers).to_not include("Proxy-Authorization")
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "proxy" do
|
35
|
-
it "is set when specified" do
|
36
|
-
globals.proxy("http://proxy.example.com")
|
37
|
-
http_request.expects(:proxy=).with("http://proxy.example.com")
|
38
|
-
|
39
|
-
new_wsdl_request.build
|
40
|
-
end
|
41
|
-
|
42
|
-
it "is not set otherwise" do
|
43
|
-
http_request.expects(:proxy=).never
|
44
|
-
new_wsdl_request.build
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe "open timeout" do
|
49
|
-
it "is set when specified" do
|
50
|
-
globals.open_timeout(22)
|
51
|
-
http_request.expects(:open_timeout=).with(22)
|
52
|
-
|
53
|
-
new_wsdl_request.build
|
54
|
-
end
|
55
|
-
|
56
|
-
it "is not set otherwise" do
|
57
|
-
http_request.expects(:open_timeout=).never
|
58
|
-
new_wsdl_request.build
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe "read timeout" do
|
63
|
-
it "is set when specified" do
|
64
|
-
globals.read_timeout(33)
|
65
|
-
http_request.expects(:read_timeout=).with(33)
|
66
|
-
|
67
|
-
new_wsdl_request.build
|
68
|
-
end
|
69
|
-
|
70
|
-
it "is not set otherwise" do
|
71
|
-
http_request.expects(:read_timeout=).never
|
72
|
-
new_wsdl_request.build
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
describe "ssl version" do
|
77
|
-
it "is set when specified" do
|
78
|
-
globals.ssl_version(:TLSv1)
|
79
|
-
http_request.auth.ssl.expects(:ssl_version=).with(:TLSv1)
|
80
|
-
|
81
|
-
new_wsdl_request.build
|
82
|
-
end
|
83
|
-
|
84
|
-
it "is not set otherwise" do
|
85
|
-
http_request.auth.ssl.expects(:ssl_version=).never
|
86
|
-
new_wsdl_request.build
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
describe "ssl verify mode" do
|
91
|
-
it "is set when specified" do
|
92
|
-
globals.ssl_verify_mode(:peer)
|
93
|
-
http_request.auth.ssl.expects(:verify_mode=).with(:peer)
|
94
|
-
|
95
|
-
new_wsdl_request.build
|
96
|
-
end
|
97
|
-
|
98
|
-
it "is not set otherwise" do
|
99
|
-
http_request.auth.ssl.expects(:verify_mode=).never
|
100
|
-
new_wsdl_request.build
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
describe "ssl ciphers" do
|
105
|
-
it "is set when specified" do
|
106
|
-
globals.ssl_ciphers(ciphers)
|
107
|
-
http_request.auth.ssl.expects(:ciphers=).with(ciphers)
|
108
|
-
|
109
|
-
new_wsdl_request.build
|
110
|
-
end
|
111
|
-
|
112
|
-
it "is not set otherwise" do
|
113
|
-
http_request.auth.ssl.expects(:ciphers=).never
|
114
|
-
new_wsdl_request.build
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
describe "ssl cert key file" do
|
119
|
-
it "is set when specified" do
|
120
|
-
cert_key = File.expand_path("../../fixtures/ssl/client_key.pem", __FILE__)
|
121
|
-
globals.ssl_cert_key_file(cert_key)
|
122
|
-
http_request.auth.ssl.expects(:cert_key_file=).with(cert_key)
|
123
|
-
|
124
|
-
new_wsdl_request.build
|
125
|
-
end
|
126
|
-
|
127
|
-
it "is not set otherwise" do
|
128
|
-
http_request.auth.ssl.expects(:cert_key_file=).never
|
129
|
-
new_wsdl_request.build
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
describe "ssl cert key password" do
|
134
|
-
it "is set when specified" do
|
135
|
-
the_pass = "secure-password!42"
|
136
|
-
globals.ssl_cert_key_password(the_pass)
|
137
|
-
http_request.auth.ssl.expects(:cert_key_password=).with(the_pass)
|
138
|
-
|
139
|
-
new_wsdl_request.build
|
140
|
-
end
|
141
|
-
|
142
|
-
it "is not set otherwise" do
|
143
|
-
http_request.auth.ssl.expects(:cert_key_password=).never
|
144
|
-
new_wsdl_request.build
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
describe "ssl encrypted cert key file" do
|
149
|
-
describe "set with an invalid decrypting password" do
|
150
|
-
it "fails when attempting to use the SSL private key" do
|
151
|
-
pass = "wrong-password"
|
152
|
-
key = File.expand_path("../../fixtures/ssl/client_encrypted_key.pem", __FILE__)
|
153
|
-
cert = File.expand_path("../../fixtures/ssl/client_encrypted_key_cert.pem", __FILE__)
|
154
|
-
|
155
|
-
globals.ssl_cert_file(cert)
|
156
|
-
globals.ssl_cert_key_password(pass)
|
157
|
-
globals.ssl_cert_key_file(key)
|
158
|
-
|
159
|
-
new_wsdl_request.build
|
160
|
-
|
161
|
-
expect { http_request.auth.ssl.cert_key }.to raise_error
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
describe "set with a valid decrypting password" do
|
166
|
-
it "handles SSL private keys properly" do
|
167
|
-
if RUBY_ENGINE == 'jruby'
|
168
|
-
pending("find out why this fails with a null pointer exception on jruby")
|
169
|
-
end
|
170
|
-
pass = "secure-password!42"
|
171
|
-
key = File.expand_path("../../fixtures/ssl/client_encrypted_key.pem", __FILE__)
|
172
|
-
cert = File.expand_path("../../fixtures/ssl/client_encrypted_key_cert.pem", __FILE__)
|
173
|
-
|
174
|
-
globals.ssl_cert_file(cert)
|
175
|
-
globals.ssl_cert_key_password(pass)
|
176
|
-
globals.ssl_cert_key_file(key)
|
177
|
-
|
178
|
-
new_wsdl_request.build
|
179
|
-
|
180
|
-
expect(http_request.auth.ssl.cert_key.to_s).to match(/BEGIN RSA PRIVATE KEY/)
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
describe "ssl cert file" do
|
186
|
-
it "is set when specified" do
|
187
|
-
cert = File.expand_path("../../fixtures/ssl/client_cert.pem", __FILE__)
|
188
|
-
globals.ssl_cert_file(cert)
|
189
|
-
http_request.auth.ssl.expects(:cert_file=).with(cert)
|
190
|
-
|
191
|
-
new_wsdl_request.build
|
192
|
-
end
|
193
|
-
|
194
|
-
it "is not set otherwise" do
|
195
|
-
http_request.auth.ssl.expects(:cert_file=).never
|
196
|
-
new_wsdl_request.build
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
describe "ssl ca cert file" do
|
201
|
-
it "is set when specified" do
|
202
|
-
ca_cert = File.expand_path("../../fixtures/ssl/client_cert.pem", __FILE__)
|
203
|
-
globals.ssl_ca_cert_file(ca_cert)
|
204
|
-
http_request.auth.ssl.expects(:ca_cert_file=).with(ca_cert)
|
205
|
-
|
206
|
-
new_wsdl_request.build
|
207
|
-
end
|
208
|
-
|
209
|
-
it "is not set otherwise" do
|
210
|
-
http_request.auth.ssl.expects(:ca_cert_file=).never
|
211
|
-
new_wsdl_request.build
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
describe "basic auth" do
|
216
|
-
it "is set when specified" do
|
217
|
-
globals.basic_auth("luke", "secret")
|
218
|
-
http_request.auth.expects(:basic).with("luke", "secret")
|
219
|
-
|
220
|
-
new_wsdl_request.build
|
221
|
-
end
|
222
|
-
|
223
|
-
it "is not set otherwise" do
|
224
|
-
http_request.auth.expects(:basic).never
|
225
|
-
new_wsdl_request.build
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
describe "digest auth" do
|
230
|
-
it "is set when specified" do
|
231
|
-
globals.digest_auth("lea", "top-secret")
|
232
|
-
http_request.auth.expects(:digest).with("lea", "top-secret")
|
233
|
-
|
234
|
-
new_wsdl_request.build
|
235
|
-
end
|
236
|
-
|
237
|
-
it "is not set otherwise" do
|
238
|
-
http_request.auth.expects(:digest).never
|
239
|
-
new_wsdl_request.build
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
describe "ntlm auth" do
|
244
|
-
it "is set when specified" do
|
245
|
-
globals.ntlm("han", "super-secret")
|
246
|
-
http_request.auth.expects(:ntlm).with("han", "super-secret")
|
247
|
-
|
248
|
-
new_wsdl_request.build
|
249
|
-
end
|
250
|
-
|
251
|
-
it "is not set otherwise" do
|
252
|
-
http_request.auth.expects(:ntlm).never
|
253
|
-
new_wsdl_request.build
|
254
|
-
end
|
255
|
-
end
|
256
|
-
end
|
257
|
-
|
258
|
-
end
|
259
|
-
|
260
|
-
describe Savon::SOAPRequest do
|
261
|
-
|
262
|
-
let(:globals) { Savon::GlobalOptions.new }
|
263
|
-
let(:http_request) { HTTPI::Request.new }
|
264
|
-
let(:ciphers) { OpenSSL::Cipher.ciphers }
|
265
|
-
|
266
|
-
def new_soap_request
|
267
|
-
Savon::SOAPRequest.new(globals, http_request)
|
268
|
-
end
|
269
|
-
|
270
|
-
describe "#build" do
|
271
|
-
it "returns an HTTPI::Request" do
|
272
|
-
soap_request = Savon::SOAPRequest.new(globals)
|
273
|
-
expect(soap_request.build).to be_an(HTTPI::Request)
|
274
|
-
end
|
275
|
-
|
276
|
-
describe "proxy" do
|
277
|
-
it "is set when specified" do
|
278
|
-
globals.proxy("http://proxy.example.com")
|
279
|
-
http_request.expects(:proxy=).with("http://proxy.example.com")
|
280
|
-
|
281
|
-
new_soap_request.build
|
282
|
-
end
|
283
|
-
|
284
|
-
it "is not set otherwise" do
|
285
|
-
http_request.expects(:proxy=).never
|
286
|
-
new_soap_request.build
|
287
|
-
end
|
288
|
-
end
|
289
|
-
|
290
|
-
describe "cookies" do
|
291
|
-
it "sets the given cookies" do
|
292
|
-
cookies = [HTTPI::Cookie.new("some-cookie=choc-chip; Path=/; HttpOnly")]
|
293
|
-
|
294
|
-
http_request.expects(:set_cookies).with(cookies)
|
295
|
-
new_soap_request.build(:cookies => cookies)
|
296
|
-
end
|
297
|
-
|
298
|
-
it "does not set the cookies if there are none" do
|
299
|
-
http_request.expects(:set_cookies).never
|
300
|
-
new_soap_request.build
|
301
|
-
end
|
302
|
-
end
|
303
|
-
|
304
|
-
describe "open timeout" do
|
305
|
-
it "is set when specified" do
|
306
|
-
globals.open_timeout(22)
|
307
|
-
http_request.expects(:open_timeout=).with(22)
|
308
|
-
|
309
|
-
new_soap_request.build
|
310
|
-
end
|
311
|
-
|
312
|
-
it "is not set otherwise" do
|
313
|
-
http_request.expects(:open_timeout=).never
|
314
|
-
new_soap_request.build
|
315
|
-
end
|
316
|
-
end
|
317
|
-
|
318
|
-
describe "read timeout" do
|
319
|
-
it "is set when specified" do
|
320
|
-
globals.read_timeout(33)
|
321
|
-
http_request.expects(:read_timeout=).with(33)
|
322
|
-
|
323
|
-
new_soap_request.build
|
324
|
-
end
|
325
|
-
|
326
|
-
it "is not set otherwise" do
|
327
|
-
http_request.expects(:read_timeout=).never
|
328
|
-
new_soap_request.build
|
329
|
-
end
|
330
|
-
end
|
331
|
-
|
332
|
-
describe "headers" do
|
333
|
-
it "are set when specified" do
|
334
|
-
globals.headers("X-Token" => "secret")
|
335
|
-
configured_http_request = new_soap_request.build
|
336
|
-
|
337
|
-
expect(configured_http_request.headers["X-Token"]).to eq("secret")
|
338
|
-
end
|
339
|
-
|
340
|
-
it "are not set otherwise" do
|
341
|
-
configured_http_request = new_soap_request.build
|
342
|
-
expect(configured_http_request.headers).to_not include("X-Token")
|
343
|
-
end
|
344
|
-
end
|
345
|
-
|
346
|
-
describe "SOAPAction header" do
|
347
|
-
it "is set and wrapped in parenthesis" do
|
348
|
-
configured_http_request = new_soap_request.build(:soap_action => "findUser")
|
349
|
-
soap_action = configured_http_request.headers["SOAPAction"]
|
350
|
-
|
351
|
-
expect(soap_action).to eq(%("findUser"))
|
352
|
-
end
|
353
|
-
|
354
|
-
it "is not set when it's explicitely set to nil" do
|
355
|
-
configured_http_request = new_soap_request.build(:soap_action => nil)
|
356
|
-
expect(configured_http_request.headers).to_not include("SOAPAction")
|
357
|
-
end
|
358
|
-
|
359
|
-
it "is not set when there is already a SOAPAction value" do
|
360
|
-
globals.headers("SOAPAction" => %("authenticate"))
|
361
|
-
configured_http_request = new_soap_request.build(:soap_action => "findUser")
|
362
|
-
soap_action = configured_http_request.headers["SOAPAction"]
|
363
|
-
|
364
|
-
expect(soap_action).to eq(%("authenticate"))
|
365
|
-
end
|
366
|
-
end
|
367
|
-
|
368
|
-
describe "Content-Type header" do
|
369
|
-
it "defaults to SOAP 1.1 and UTF-8" do
|
370
|
-
configured_http_request = new_soap_request.build
|
371
|
-
content_type = configured_http_request.headers["Content-Type"]
|
372
|
-
|
373
|
-
expect(content_type).to eq("text/xml;charset=UTF-8")
|
374
|
-
end
|
375
|
-
|
376
|
-
it "can be changed to SOAP 1.2 and any other encoding" do
|
377
|
-
globals.soap_version(2)
|
378
|
-
globals.encoding("ISO-8859-1")
|
379
|
-
|
380
|
-
configured_http_request = new_soap_request.build
|
381
|
-
content_type = configured_http_request.headers["Content-Type"]
|
382
|
-
|
383
|
-
expect(content_type).to eq("application/soap+xml;charset=ISO-8859-1")
|
384
|
-
end
|
385
|
-
|
386
|
-
it "is not set when there is already a Content-Type value" do
|
387
|
-
globals.headers("Content-Type" => "application/awesomeness;charset=UTF-3000")
|
388
|
-
configured_http_request = new_soap_request.build(:soap_action => "findUser")
|
389
|
-
content_type = configured_http_request.headers["Content-Type"]
|
390
|
-
|
391
|
-
expect(content_type).to eq("application/awesomeness;charset=UTF-3000")
|
392
|
-
end
|
393
|
-
end
|
394
|
-
|
395
|
-
describe "ssl version" do
|
396
|
-
it "is set when specified" do
|
397
|
-
globals.ssl_version(:TLSv1)
|
398
|
-
http_request.auth.ssl.expects(:ssl_version=).with(:TLSv1)
|
399
|
-
|
400
|
-
new_soap_request.build
|
401
|
-
end
|
402
|
-
|
403
|
-
it "is not set otherwise" do
|
404
|
-
http_request.auth.ssl.expects(:ssl_version=).never
|
405
|
-
new_soap_request.build
|
406
|
-
end
|
407
|
-
end
|
408
|
-
|
409
|
-
describe "ssl verify mode" do
|
410
|
-
it "is set when specified" do
|
411
|
-
globals.ssl_verify_mode(:peer)
|
412
|
-
http_request.auth.ssl.expects(:verify_mode=).with(:peer)
|
413
|
-
|
414
|
-
new_soap_request.build
|
415
|
-
end
|
416
|
-
|
417
|
-
it "is not set otherwise" do
|
418
|
-
http_request.auth.ssl.expects(:verify_mode=).never
|
419
|
-
new_soap_request.build
|
420
|
-
end
|
421
|
-
end
|
422
|
-
|
423
|
-
describe "ssl ciphers" do
|
424
|
-
it "is set when specified" do
|
425
|
-
globals.ssl_ciphers(ciphers)
|
426
|
-
http_request.auth.ssl.expects(:ciphers=).with(ciphers)
|
427
|
-
|
428
|
-
new_soap_request.build
|
429
|
-
end
|
430
|
-
|
431
|
-
it "is not set otherwise" do
|
432
|
-
http_request.auth.ssl.expects(:ciphers=).never
|
433
|
-
new_soap_request.build
|
434
|
-
end
|
435
|
-
end
|
436
|
-
|
437
|
-
describe "ssl cert key file" do
|
438
|
-
it "is set when specified" do
|
439
|
-
cert_key = File.expand_path("../../fixtures/ssl/client_key.pem", __FILE__)
|
440
|
-
globals.ssl_cert_key_file(cert_key)
|
441
|
-
http_request.auth.ssl.expects(:cert_key_file=).with(cert_key)
|
442
|
-
|
443
|
-
new_soap_request.build
|
444
|
-
end
|
445
|
-
|
446
|
-
it "is not set otherwise" do
|
447
|
-
http_request.auth.ssl.expects(:cert_key_file=).never
|
448
|
-
new_soap_request.build
|
449
|
-
end
|
450
|
-
end
|
451
|
-
|
452
|
-
describe "ssl cert key password" do
|
453
|
-
it "is set when specified" do
|
454
|
-
the_pass = "secure-password!42"
|
455
|
-
globals.ssl_cert_key_password(the_pass)
|
456
|
-
http_request.auth.ssl.expects(:cert_key_password=).with(the_pass)
|
457
|
-
|
458
|
-
new_soap_request.build
|
459
|
-
end
|
460
|
-
|
461
|
-
it "is not set otherwise" do
|
462
|
-
http_request.auth.ssl.expects(:cert_key_password=).never
|
463
|
-
new_soap_request.build
|
464
|
-
end
|
465
|
-
end
|
466
|
-
|
467
|
-
describe "ssl cert file" do
|
468
|
-
it "is set when specified" do
|
469
|
-
cert = File.expand_path("../../fixtures/ssl/client_cert.pem", __FILE__)
|
470
|
-
globals.ssl_cert_file(cert)
|
471
|
-
http_request.auth.ssl.expects(:cert_file=).with(cert)
|
472
|
-
|
473
|
-
new_soap_request.build
|
474
|
-
end
|
475
|
-
|
476
|
-
it "is not set otherwise" do
|
477
|
-
http_request.auth.ssl.expects(:cert_file=).never
|
478
|
-
new_soap_request.build
|
479
|
-
end
|
480
|
-
end
|
481
|
-
|
482
|
-
describe "ssl ca cert file" do
|
483
|
-
it "is set when specified" do
|
484
|
-
ca_cert = File.expand_path("../../fixtures/ssl/client_cert.pem", __FILE__)
|
485
|
-
globals.ssl_ca_cert_file(ca_cert)
|
486
|
-
http_request.auth.ssl.expects(:ca_cert_file=).with(ca_cert)
|
487
|
-
|
488
|
-
new_soap_request.build
|
489
|
-
end
|
490
|
-
|
491
|
-
it "is not set otherwise" do
|
492
|
-
http_request.auth.ssl.expects(:ca_cert_file=).never
|
493
|
-
new_soap_request.build
|
494
|
-
end
|
495
|
-
end
|
496
|
-
|
497
|
-
describe "basic auth" do
|
498
|
-
it "is set when specified" do
|
499
|
-
globals.basic_auth("luke", "secret")
|
500
|
-
http_request.auth.expects(:basic).with("luke", "secret")
|
501
|
-
|
502
|
-
new_soap_request.build
|
503
|
-
end
|
504
|
-
|
505
|
-
it "is not set otherwise" do
|
506
|
-
http_request.auth.expects(:basic).never
|
507
|
-
new_soap_request.build
|
508
|
-
end
|
509
|
-
end
|
510
|
-
|
511
|
-
describe "digest auth" do
|
512
|
-
it "is set when specified" do
|
513
|
-
globals.digest_auth("lea", "top-secret")
|
514
|
-
http_request.auth.expects(:digest).with("lea", "top-secret")
|
515
|
-
|
516
|
-
new_soap_request.build
|
517
|
-
end
|
518
|
-
|
519
|
-
it "is not set otherwise" do
|
520
|
-
http_request.auth.expects(:digest).never
|
521
|
-
new_soap_request.build
|
522
|
-
end
|
523
|
-
end
|
524
|
-
|
525
|
-
describe "ntlm auth" do
|
526
|
-
it "is set when specified" do
|
527
|
-
globals.ntlm("han", "super-secret")
|
528
|
-
http_request.auth.expects(:ntlm).with("han", "super-secret")
|
529
|
-
|
530
|
-
new_soap_request.build
|
531
|
-
end
|
532
|
-
|
533
|
-
it "is not set otherwise" do
|
534
|
-
http_request.auth.expects(:ntlm).never
|
535
|
-
new_soap_request.build
|
536
|
-
end
|
537
|
-
end
|
538
|
-
end
|
539
|
-
|
540
|
-
end
|