savon 2.11.2 → 2.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +112 -73
- data/README.md +25 -16
- 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 +71 -2
- data/lib/savon/qualified_message.rb +5 -4
- data/lib/savon/request.rb +18 -3
- data/lib/savon/request_logger.rb +8 -2
- data/lib/savon/response.rb +52 -5
- data/lib/savon/soap_fault.rb +2 -3
- data/lib/savon/string_utils.rb +17 -0
- data/lib/savon/version.rb +2 -1
- data/lib/savon.rb +2 -0
- metadata +62 -97
- data/.gitignore +0 -14
- data/.travis.yml +0 -19
- 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/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 -66
- 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 -1075
- data/spec/savon/qualified_message_spec.rb +0 -68
- data/spec/savon/request_logger_spec.rb +0 -37
- data/spec/savon/request_spec.rb +0 -496
- data/spec/savon/response_spec.rb +0 -270
- 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,68 +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
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
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,496 +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
|
-
|
9
|
-
def new_wsdl_request
|
10
|
-
Savon::WSDLRequest.new(globals, http_request)
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "#build" do
|
14
|
-
it "returns an HTTPI::Request" do
|
15
|
-
wsdl_request = Savon::WSDLRequest.new(globals)
|
16
|
-
expect(wsdl_request.build).to be_an(HTTPI::Request)
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "proxy" do
|
20
|
-
it "is set when specified" do
|
21
|
-
globals.proxy("http://proxy.example.com")
|
22
|
-
http_request.expects(:proxy=).with("http://proxy.example.com")
|
23
|
-
|
24
|
-
new_wsdl_request.build
|
25
|
-
end
|
26
|
-
|
27
|
-
it "is not set otherwise" do
|
28
|
-
http_request.expects(:proxy=).never
|
29
|
-
new_wsdl_request.build
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "open timeout" do
|
34
|
-
it "is set when specified" do
|
35
|
-
globals.open_timeout(22)
|
36
|
-
http_request.expects(:open_timeout=).with(22)
|
37
|
-
|
38
|
-
new_wsdl_request.build
|
39
|
-
end
|
40
|
-
|
41
|
-
it "is not set otherwise" do
|
42
|
-
http_request.expects(:open_timeout=).never
|
43
|
-
new_wsdl_request.build
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe "read timeout" do
|
48
|
-
it "is set when specified" do
|
49
|
-
globals.read_timeout(33)
|
50
|
-
http_request.expects(:read_timeout=).with(33)
|
51
|
-
|
52
|
-
new_wsdl_request.build
|
53
|
-
end
|
54
|
-
|
55
|
-
it "is not set otherwise" do
|
56
|
-
http_request.expects(:read_timeout=).never
|
57
|
-
new_wsdl_request.build
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
describe "ssl version" do
|
62
|
-
it "is set when specified" do
|
63
|
-
globals.ssl_version(:SSLv3)
|
64
|
-
http_request.auth.ssl.expects(:ssl_version=).with(:SSLv3)
|
65
|
-
|
66
|
-
new_wsdl_request.build
|
67
|
-
end
|
68
|
-
|
69
|
-
it "is not set otherwise" do
|
70
|
-
http_request.auth.ssl.expects(:ssl_version=).never
|
71
|
-
new_wsdl_request.build
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe "ssl verify mode" do
|
76
|
-
it "is set when specified" do
|
77
|
-
globals.ssl_verify_mode(:none)
|
78
|
-
http_request.auth.ssl.expects(:verify_mode=).with(:none)
|
79
|
-
|
80
|
-
new_wsdl_request.build
|
81
|
-
end
|
82
|
-
|
83
|
-
it "is not set otherwise" do
|
84
|
-
http_request.auth.ssl.expects(:verify_mode=).never
|
85
|
-
new_wsdl_request.build
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
describe "ssl cert key file" do
|
90
|
-
it "is set when specified" do
|
91
|
-
cert_key = File.expand_path("../../fixtures/ssl/client_key.pem", __FILE__)
|
92
|
-
globals.ssl_cert_key_file(cert_key)
|
93
|
-
http_request.auth.ssl.expects(:cert_key_file=).with(cert_key)
|
94
|
-
|
95
|
-
new_wsdl_request.build
|
96
|
-
end
|
97
|
-
|
98
|
-
it "is not set otherwise" do
|
99
|
-
http_request.auth.ssl.expects(:cert_key_file=).never
|
100
|
-
new_wsdl_request.build
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
describe "ssl cert key password" do
|
105
|
-
it "is set when specified" do
|
106
|
-
the_pass = "secure-password!42"
|
107
|
-
globals.ssl_cert_key_password(the_pass)
|
108
|
-
http_request.auth.ssl.expects(:cert_key_password=).with(the_pass)
|
109
|
-
|
110
|
-
new_wsdl_request.build
|
111
|
-
end
|
112
|
-
|
113
|
-
it "is not set otherwise" do
|
114
|
-
http_request.auth.ssl.expects(:cert_key_password=).never
|
115
|
-
new_wsdl_request.build
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
describe "ssl encrypted cert key file" do
|
120
|
-
describe "set with an invalid decrypting password" do
|
121
|
-
it "fails when attempting to use the SSL private key" do
|
122
|
-
pass = "wrong-password"
|
123
|
-
key = File.expand_path("../../fixtures/ssl/client_encrypted_key.pem", __FILE__)
|
124
|
-
cert = File.expand_path("../../fixtures/ssl/client_encrypted_key_cert.pem", __FILE__)
|
125
|
-
|
126
|
-
globals.ssl_cert_file(cert)
|
127
|
-
globals.ssl_cert_key_password(pass)
|
128
|
-
globals.ssl_cert_key_file(key)
|
129
|
-
|
130
|
-
new_wsdl_request.build
|
131
|
-
|
132
|
-
expect { http_request.auth.ssl.cert_key }.to raise_error
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
describe "set with a valid decrypting password" do
|
137
|
-
it "handles SSL private keys properly" do
|
138
|
-
if RUBY_ENGINE == 'jruby'
|
139
|
-
pending("find out why this fails with a null pointer exception on jruby")
|
140
|
-
end
|
141
|
-
pass = "secure-password!42"
|
142
|
-
key = File.expand_path("../../fixtures/ssl/client_encrypted_key.pem", __FILE__)
|
143
|
-
cert = File.expand_path("../../fixtures/ssl/client_encrypted_key_cert.pem", __FILE__)
|
144
|
-
|
145
|
-
globals.ssl_cert_file(cert)
|
146
|
-
globals.ssl_cert_key_password(pass)
|
147
|
-
globals.ssl_cert_key_file(key)
|
148
|
-
|
149
|
-
new_wsdl_request.build
|
150
|
-
|
151
|
-
expect(http_request.auth.ssl.cert_key.to_s).to match(/BEGIN RSA PRIVATE KEY/)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
describe "ssl cert file" do
|
157
|
-
it "is set when specified" do
|
158
|
-
cert = File.expand_path("../../fixtures/ssl/client_cert.pem", __FILE__)
|
159
|
-
globals.ssl_cert_file(cert)
|
160
|
-
http_request.auth.ssl.expects(:cert_file=).with(cert)
|
161
|
-
|
162
|
-
new_wsdl_request.build
|
163
|
-
end
|
164
|
-
|
165
|
-
it "is not set otherwise" do
|
166
|
-
http_request.auth.ssl.expects(:cert_file=).never
|
167
|
-
new_wsdl_request.build
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
describe "ssl ca cert file" do
|
172
|
-
it "is set when specified" do
|
173
|
-
ca_cert = File.expand_path("../../fixtures/ssl/client_cert.pem", __FILE__)
|
174
|
-
globals.ssl_ca_cert_file(ca_cert)
|
175
|
-
http_request.auth.ssl.expects(:ca_cert_file=).with(ca_cert)
|
176
|
-
|
177
|
-
new_wsdl_request.build
|
178
|
-
end
|
179
|
-
|
180
|
-
it "is not set otherwise" do
|
181
|
-
http_request.auth.ssl.expects(:ca_cert_file=).never
|
182
|
-
new_wsdl_request.build
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
describe "basic auth" do
|
187
|
-
it "is set when specified" do
|
188
|
-
globals.basic_auth("luke", "secret")
|
189
|
-
http_request.auth.expects(:basic).with("luke", "secret")
|
190
|
-
|
191
|
-
new_wsdl_request.build
|
192
|
-
end
|
193
|
-
|
194
|
-
it "is not set otherwise" do
|
195
|
-
http_request.auth.expects(:basic).never
|
196
|
-
new_wsdl_request.build
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
describe "digest auth" do
|
201
|
-
it "is set when specified" do
|
202
|
-
globals.digest_auth("lea", "top-secret")
|
203
|
-
http_request.auth.expects(:digest).with("lea", "top-secret")
|
204
|
-
|
205
|
-
new_wsdl_request.build
|
206
|
-
end
|
207
|
-
|
208
|
-
it "is not set otherwise" do
|
209
|
-
http_request.auth.expects(:digest).never
|
210
|
-
new_wsdl_request.build
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
describe "ntlm auth" do
|
215
|
-
it "is set when specified" do
|
216
|
-
globals.ntlm("han", "super-secret")
|
217
|
-
http_request.auth.expects(:ntlm).with("han", "super-secret")
|
218
|
-
|
219
|
-
new_wsdl_request.build
|
220
|
-
end
|
221
|
-
|
222
|
-
it "is not set otherwise" do
|
223
|
-
http_request.auth.expects(:ntlm).never
|
224
|
-
new_wsdl_request.build
|
225
|
-
end
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
end
|
230
|
-
|
231
|
-
describe Savon::SOAPRequest do
|
232
|
-
|
233
|
-
let(:globals) { Savon::GlobalOptions.new }
|
234
|
-
let(:http_request) { HTTPI::Request.new }
|
235
|
-
|
236
|
-
def new_soap_request
|
237
|
-
Savon::SOAPRequest.new(globals, http_request)
|
238
|
-
end
|
239
|
-
|
240
|
-
describe "#build" do
|
241
|
-
it "returns an HTTPI::Request" do
|
242
|
-
soap_request = Savon::SOAPRequest.new(globals)
|
243
|
-
expect(soap_request.build).to be_an(HTTPI::Request)
|
244
|
-
end
|
245
|
-
|
246
|
-
describe "proxy" do
|
247
|
-
it "is set when specified" do
|
248
|
-
globals.proxy("http://proxy.example.com")
|
249
|
-
http_request.expects(:proxy=).with("http://proxy.example.com")
|
250
|
-
|
251
|
-
new_soap_request.build
|
252
|
-
end
|
253
|
-
|
254
|
-
it "is not set otherwise" do
|
255
|
-
http_request.expects(:proxy=).never
|
256
|
-
new_soap_request.build
|
257
|
-
end
|
258
|
-
end
|
259
|
-
|
260
|
-
describe "cookies" do
|
261
|
-
it "sets the given cookies" do
|
262
|
-
cookies = [HTTPI::Cookie.new("some-cookie=choc-chip; Path=/; HttpOnly")]
|
263
|
-
|
264
|
-
http_request.expects(:set_cookies).with(cookies)
|
265
|
-
new_soap_request.build(:cookies => cookies)
|
266
|
-
end
|
267
|
-
|
268
|
-
it "does not set the cookies if there are none" do
|
269
|
-
http_request.expects(:set_cookies).never
|
270
|
-
new_soap_request.build
|
271
|
-
end
|
272
|
-
end
|
273
|
-
|
274
|
-
describe "open timeout" do
|
275
|
-
it "is set when specified" do
|
276
|
-
globals.open_timeout(22)
|
277
|
-
http_request.expects(:open_timeout=).with(22)
|
278
|
-
|
279
|
-
new_soap_request.build
|
280
|
-
end
|
281
|
-
|
282
|
-
it "is not set otherwise" do
|
283
|
-
http_request.expects(:open_timeout=).never
|
284
|
-
new_soap_request.build
|
285
|
-
end
|
286
|
-
end
|
287
|
-
|
288
|
-
describe "read timeout" do
|
289
|
-
it "is set when specified" do
|
290
|
-
globals.read_timeout(33)
|
291
|
-
http_request.expects(:read_timeout=).with(33)
|
292
|
-
|
293
|
-
new_soap_request.build
|
294
|
-
end
|
295
|
-
|
296
|
-
it "is not set otherwise" do
|
297
|
-
http_request.expects(:read_timeout=).never
|
298
|
-
new_soap_request.build
|
299
|
-
end
|
300
|
-
end
|
301
|
-
|
302
|
-
describe "headers" do
|
303
|
-
it "are set when specified" do
|
304
|
-
globals.headers("X-Token" => "secret")
|
305
|
-
configured_http_request = new_soap_request.build
|
306
|
-
|
307
|
-
expect(configured_http_request.headers["X-Token"]).to eq("secret")
|
308
|
-
end
|
309
|
-
|
310
|
-
it "are not set otherwise" do
|
311
|
-
configured_http_request = new_soap_request.build
|
312
|
-
expect(configured_http_request.headers).to_not include("X-Token")
|
313
|
-
end
|
314
|
-
end
|
315
|
-
|
316
|
-
describe "SOAPAction header" do
|
317
|
-
it "is set and wrapped in parenthesis" do
|
318
|
-
configured_http_request = new_soap_request.build(:soap_action => "findUser")
|
319
|
-
soap_action = configured_http_request.headers["SOAPAction"]
|
320
|
-
|
321
|
-
expect(soap_action).to eq(%("findUser"))
|
322
|
-
end
|
323
|
-
|
324
|
-
it "is not set when it's explicitely set to nil" do
|
325
|
-
configured_http_request = new_soap_request.build(:soap_action => nil)
|
326
|
-
expect(configured_http_request.headers).to_not include("SOAPAction")
|
327
|
-
end
|
328
|
-
|
329
|
-
it "is not set when there is already a SOAPAction value" do
|
330
|
-
globals.headers("SOAPAction" => %("authenticate"))
|
331
|
-
configured_http_request = new_soap_request.build(:soap_action => "findUser")
|
332
|
-
soap_action = configured_http_request.headers["SOAPAction"]
|
333
|
-
|
334
|
-
expect(soap_action).to eq(%("authenticate"))
|
335
|
-
end
|
336
|
-
end
|
337
|
-
|
338
|
-
describe "Content-Type header" do
|
339
|
-
it "defaults to SOAP 1.1 and UTF-8" do
|
340
|
-
configured_http_request = new_soap_request.build
|
341
|
-
content_type = configured_http_request.headers["Content-Type"]
|
342
|
-
|
343
|
-
expect(content_type).to eq("text/xml;charset=UTF-8")
|
344
|
-
end
|
345
|
-
|
346
|
-
it "can be changed to SOAP 1.2 and any other encoding" do
|
347
|
-
globals.soap_version(2)
|
348
|
-
globals.encoding("ISO-8859-1")
|
349
|
-
|
350
|
-
configured_http_request = new_soap_request.build
|
351
|
-
content_type = configured_http_request.headers["Content-Type"]
|
352
|
-
|
353
|
-
expect(content_type).to eq("application/soap+xml;charset=ISO-8859-1")
|
354
|
-
end
|
355
|
-
|
356
|
-
it "is not set when there is already a Content-Type value" do
|
357
|
-
globals.headers("Content-Type" => "application/awesomeness;charset=UTF-3000")
|
358
|
-
configured_http_request = new_soap_request.build(:soap_action => "findUser")
|
359
|
-
content_type = configured_http_request.headers["Content-Type"]
|
360
|
-
|
361
|
-
expect(content_type).to eq("application/awesomeness;charset=UTF-3000")
|
362
|
-
end
|
363
|
-
end
|
364
|
-
|
365
|
-
describe "ssl version" do
|
366
|
-
it "is set when specified" do
|
367
|
-
globals.ssl_version(:SSLv3)
|
368
|
-
http_request.auth.ssl.expects(:ssl_version=).with(:SSLv3)
|
369
|
-
|
370
|
-
new_soap_request.build
|
371
|
-
end
|
372
|
-
|
373
|
-
it "is not set otherwise" do
|
374
|
-
http_request.auth.ssl.expects(:ssl_version=).never
|
375
|
-
new_soap_request.build
|
376
|
-
end
|
377
|
-
end
|
378
|
-
|
379
|
-
describe "ssl verify mode" do
|
380
|
-
it "is set when specified" do
|
381
|
-
globals.ssl_verify_mode(:none)
|
382
|
-
http_request.auth.ssl.expects(:verify_mode=).with(:none)
|
383
|
-
|
384
|
-
new_soap_request.build
|
385
|
-
end
|
386
|
-
|
387
|
-
it "is not set otherwise" do
|
388
|
-
http_request.auth.ssl.expects(:verify_mode=).never
|
389
|
-
new_soap_request.build
|
390
|
-
end
|
391
|
-
end
|
392
|
-
|
393
|
-
describe "ssl cert key file" do
|
394
|
-
it "is set when specified" do
|
395
|
-
cert_key = File.expand_path("../../fixtures/ssl/client_key.pem", __FILE__)
|
396
|
-
globals.ssl_cert_key_file(cert_key)
|
397
|
-
http_request.auth.ssl.expects(:cert_key_file=).with(cert_key)
|
398
|
-
|
399
|
-
new_soap_request.build
|
400
|
-
end
|
401
|
-
|
402
|
-
it "is not set otherwise" do
|
403
|
-
http_request.auth.ssl.expects(:cert_key_file=).never
|
404
|
-
new_soap_request.build
|
405
|
-
end
|
406
|
-
end
|
407
|
-
|
408
|
-
describe "ssl cert key password" do
|
409
|
-
it "is set when specified" do
|
410
|
-
the_pass = "secure-password!42"
|
411
|
-
globals.ssl_cert_key_password(the_pass)
|
412
|
-
http_request.auth.ssl.expects(:cert_key_password=).with(the_pass)
|
413
|
-
|
414
|
-
new_soap_request.build
|
415
|
-
end
|
416
|
-
|
417
|
-
it "is not set otherwise" do
|
418
|
-
http_request.auth.ssl.expects(:cert_key_password=).never
|
419
|
-
new_soap_request.build
|
420
|
-
end
|
421
|
-
end
|
422
|
-
|
423
|
-
describe "ssl cert file" do
|
424
|
-
it "is set when specified" do
|
425
|
-
cert = File.expand_path("../../fixtures/ssl/client_cert.pem", __FILE__)
|
426
|
-
globals.ssl_cert_file(cert)
|
427
|
-
http_request.auth.ssl.expects(:cert_file=).with(cert)
|
428
|
-
|
429
|
-
new_soap_request.build
|
430
|
-
end
|
431
|
-
|
432
|
-
it "is not set otherwise" do
|
433
|
-
http_request.auth.ssl.expects(:cert_file=).never
|
434
|
-
new_soap_request.build
|
435
|
-
end
|
436
|
-
end
|
437
|
-
|
438
|
-
describe "ssl ca cert file" do
|
439
|
-
it "is set when specified" do
|
440
|
-
ca_cert = File.expand_path("../../fixtures/ssl/client_cert.pem", __FILE__)
|
441
|
-
globals.ssl_ca_cert_file(ca_cert)
|
442
|
-
http_request.auth.ssl.expects(:ca_cert_file=).with(ca_cert)
|
443
|
-
|
444
|
-
new_soap_request.build
|
445
|
-
end
|
446
|
-
|
447
|
-
it "is not set otherwise" do
|
448
|
-
http_request.auth.ssl.expects(:ca_cert_file=).never
|
449
|
-
new_soap_request.build
|
450
|
-
end
|
451
|
-
end
|
452
|
-
|
453
|
-
describe "basic auth" do
|
454
|
-
it "is set when specified" do
|
455
|
-
globals.basic_auth("luke", "secret")
|
456
|
-
http_request.auth.expects(:basic).with("luke", "secret")
|
457
|
-
|
458
|
-
new_soap_request.build
|
459
|
-
end
|
460
|
-
|
461
|
-
it "is not set otherwise" do
|
462
|
-
http_request.auth.expects(:basic).never
|
463
|
-
new_soap_request.build
|
464
|
-
end
|
465
|
-
end
|
466
|
-
|
467
|
-
describe "digest auth" do
|
468
|
-
it "is set when specified" do
|
469
|
-
globals.digest_auth("lea", "top-secret")
|
470
|
-
http_request.auth.expects(:digest).with("lea", "top-secret")
|
471
|
-
|
472
|
-
new_soap_request.build
|
473
|
-
end
|
474
|
-
|
475
|
-
it "is not set otherwise" do
|
476
|
-
http_request.auth.expects(:digest).never
|
477
|
-
new_soap_request.build
|
478
|
-
end
|
479
|
-
end
|
480
|
-
|
481
|
-
describe "ntlm auth" do
|
482
|
-
it "is set when specified" do
|
483
|
-
globals.ntlm("han", "super-secret")
|
484
|
-
http_request.auth.expects(:ntlm).with("han", "super-secret")
|
485
|
-
|
486
|
-
new_soap_request.build
|
487
|
-
end
|
488
|
-
|
489
|
-
it "is not set otherwise" do
|
490
|
-
http_request.auth.expects(:ntlm).never
|
491
|
-
new_soap_request.build
|
492
|
-
end
|
493
|
-
end
|
494
|
-
end
|
495
|
-
|
496
|
-
end
|