soaspec 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +4 -0
- data/exe/soaspec +3 -2
- data/lib/soaspec/exchange_handlers/rest_handler.rb +2 -2
- data/lib/soaspec/interpreter.rb +14 -0
- data/lib/soaspec/version.rb +1 -1
- data/lib/soaspec/virtual_server.rb +13 -0
- data/lib/soaspec/wsdl_generator.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d04d8069ff220fabc590725f88eb322d1346067c16efcdd007d235b55ac2d20
|
4
|
+
data.tar.gz: b7391039e8f3dd04845b49bba4fba4ca2d50dd444c088ceabc7f515907c2949c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0ef8082d8e1e24576a0ea9bb9e477e33764a135b994d26e4a52a6a1366f57e8e3e89cb7d22f64914abbac27bce5c04ab21b6e1d9ee7703025539875b7187769
|
7
|
+
data.tar.gz: c984d69e28910e13171cd588ee98f363f0186b0d46b9ee8144a05964d7089054308f4017d4842ee7b064d25661b42c02d8a69fbf1c7a4c3e23106481819cdb61
|
data/ChangeLog
CHANGED
data/exe/soaspec
CHANGED
@@ -79,9 +79,10 @@ module Soaspec
|
|
79
79
|
|
80
80
|
desc 'generate', 'Generate initial test code from wsdl'
|
81
81
|
long_desc <<-LONGDESC
|
82
|
-
If no wsdl is given a server will be started from which
|
82
|
+
If no wsdl is given a server will be started with a web page front end from which ExchangeHandler's can
|
83
|
+
can be created.
|
83
84
|
|
84
|
-
`soaspec generate wsdl=wsdl name=ServiceName
|
85
|
+
`soaspec generate wsdl=wsdl name=ServiceName` will generate the initial files and folders to test each operation in a wsdl
|
85
86
|
\x5
|
86
87
|
Additionally the auth parameter can be used to use basic authentication to retrieve the WSDL.
|
87
88
|
To do use the following `soaspec generate --auth=basic`
|
@@ -193,7 +193,7 @@ module Soaspec
|
|
193
193
|
# @return [Enumerable] Value inside element found through Xpath
|
194
194
|
def xpath_elements_for(response: nil, xpath: nil, attribute: nil)
|
195
195
|
raise ArgumentError unless response && xpath
|
196
|
-
raise "Can't perform XPATH if response is not XML" unless Interpreter.response_type_for(response)
|
196
|
+
raise "Can't perform XPATH if response is not XML" unless %i[xml html].include? Interpreter.response_type_for(response)
|
197
197
|
|
198
198
|
xpath = prefix_xpath(xpath, attribute)
|
199
199
|
temp_doc = Nokogiri.parse(response.body).dup
|
@@ -239,7 +239,7 @@ module Soaspec
|
|
239
239
|
def value_from_path(response, path, attribute: nil)
|
240
240
|
path = path.to_s
|
241
241
|
case Interpreter.response_type_for(response)
|
242
|
-
when :xml
|
242
|
+
when :xml, :html
|
243
243
|
result = xpath_elements_for(response: response, xpath: path, attribute: attribute).first
|
244
244
|
raise NoElementAtPath, "No value at Xpath '#{prefix_xpath(path, attribute)}' in '#{response.body}'" unless result
|
245
245
|
return result.inner_text if attribute.nil?
|
data/lib/soaspec/interpreter.rb
CHANGED
@@ -20,6 +20,8 @@ class Interpreter
|
|
20
20
|
:xml
|
21
21
|
elsif json?
|
22
22
|
:json
|
23
|
+
elsif html?
|
24
|
+
:html
|
23
25
|
else
|
24
26
|
:string
|
25
27
|
end
|
@@ -54,6 +56,18 @@ class Interpreter
|
|
54
56
|
# @return [Boolean] Whether valid XML
|
55
57
|
def xml?
|
56
58
|
Nokogiri::XML(@response) { |config| config.options = Nokogiri::XML::ParseOptions::STRICT }
|
59
|
+
true
|
60
|
+
rescue Nokogiri::XML::SyntaxError => e
|
61
|
+
self.xml_errors = e
|
62
|
+
false
|
63
|
+
end
|
64
|
+
|
65
|
+
# @return [Boolean] Whether valid HTML. Must include at least one tag
|
66
|
+
def html?
|
67
|
+
Nokogiri::HTML(@response) do |config|
|
68
|
+
config.options = Nokogiri::XML::ParseOptions::DEFAULT_HTML
|
69
|
+
end
|
70
|
+
@response.include?('<') && @response.include?('>')
|
57
71
|
rescue Nokogiri::XML::SyntaxError => e
|
58
72
|
self.xml_errors = e
|
59
73
|
false
|
data/lib/soaspec/version.rb
CHANGED
@@ -189,5 +189,18 @@ module Soaspec
|
|
189
189
|
}
|
190
190
|
BOOKS
|
191
191
|
end
|
192
|
+
|
193
|
+
documentation 'HTML doc that is not valid HTML'
|
194
|
+
get '/html_doc' do
|
195
|
+
<<-HTML
|
196
|
+
<!doctype html>
|
197
|
+
<html lang="en">
|
198
|
+
<head></head>
|
199
|
+
<body>
|
200
|
+
<h1>Heading</h1>
|
201
|
+
</body>
|
202
|
+
</html>
|
203
|
+
HTML
|
204
|
+
end
|
192
205
|
end
|
193
206
|
end
|
@@ -7,10 +7,12 @@ module Soaspec
|
|
7
7
|
|
8
8
|
# Generate from WSDL
|
9
9
|
def generate_from_wsdl(options)
|
10
|
-
|
10
|
+
if options[:auth] == 'basic'
|
11
|
+
auth_name, auth_password = enter_auth_details
|
12
|
+
savon_options[:basic_auth] = [auth_name, auth_password]
|
13
|
+
end
|
11
14
|
@virtual = false
|
12
15
|
savon_options = { wsdl: options[:wsdl] }
|
13
|
-
savon_options[:basic_auth] = [auth_name, auth_password] if options[:auth] == 'basic'
|
14
16
|
|
15
17
|
wsdl_doc = Savon.client(**savon_options).wsdl
|
16
18
|
@wsdl_schemas = wsdl_doc.parser.schemas
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soaspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SamuelGarrattIQA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|