petstore-test-sdk 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +90 -0
- data/lib/swagger_petstore_open_api30/api_helper.rb +10 -0
- data/lib/swagger_petstore_open_api30/client.rb +72 -0
- data/lib/swagger_petstore_open_api30/configuration.rb +125 -0
- data/lib/swagger_petstore_open_api30/controllers/base_controller.rb +66 -0
- data/lib/swagger_petstore_open_api30/controllers/pet_controller.rb +226 -0
- data/lib/swagger_petstore_open_api30/controllers/store_controller.rb +107 -0
- data/lib/swagger_petstore_open_api30/controllers/user_controller.rb +189 -0
- data/lib/swagger_petstore_open_api30/exceptions/api_exception.rb +10 -0
- data/lib/swagger_petstore_open_api30/http/auth/custom_header_authentication.rb +42 -0
- data/lib/swagger_petstore_open_api30/http/http_call_back.rb +10 -0
- data/lib/swagger_petstore_open_api30/http/http_method_enum.rb +10 -0
- data/lib/swagger_petstore_open_api30/http/http_request.rb +10 -0
- data/lib/swagger_petstore_open_api30/http/http_response.rb +10 -0
- data/lib/swagger_petstore_open_api30/models/address.rb +77 -0
- data/lib/swagger_petstore_open_api30/models/base_model.rb +62 -0
- data/lib/swagger_petstore_open_api30/models/category.rb +59 -0
- data/lib/swagger_petstore_open_api30/models/customer.rb +77 -0
- data/lib/swagger_petstore_open_api30/models/order.rb +105 -0
- data/lib/swagger_petstore_open_api30/models/order_status_enum.rb +26 -0
- data/lib/swagger_petstore_open_api30/models/pet.rb +103 -0
- data/lib/swagger_petstore_open_api30/models/pet_image.rb +68 -0
- data/lib/swagger_petstore_open_api30/models/pet_status_enum.rb +26 -0
- data/lib/swagger_petstore_open_api30/models/status_enum.rb +26 -0
- data/lib/swagger_petstore_open_api30/models/tag.rb +59 -0
- data/lib/swagger_petstore_open_api30/models/user.rb +115 -0
- data/lib/swagger_petstore_open_api30/utilities/date_time_helper.rb +11 -0
- data/lib/swagger_petstore_open_api30/utilities/file_wrapper.rb +16 -0
- data/lib/swagger_petstore_open_api30.rb +53 -0
- data/test/controllers/controller_test_base.rb +29 -0
- data/test/controllers/test_pet_controller.rb +76 -0
- data/test/controllers/test_store_controller.rb +58 -0
- data/test/controllers/test_user_controller.rb +55 -0
- data/test/http_response_catcher.rb +19 -0
- metadata +154 -0
@@ -0,0 +1,76 @@
|
|
1
|
+
# swagger_petstore_open_api30
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
require_relative 'controller_test_base'
|
7
|
+
|
8
|
+
class PetControllerTests < ControllerTestBase
|
9
|
+
# Called only once for the class before any test has executed
|
10
|
+
def setup
|
11
|
+
setup_class
|
12
|
+
@controller = @client.pet
|
13
|
+
@response_catcher = @controller.http_call_back
|
14
|
+
end
|
15
|
+
|
16
|
+
# Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
17
|
+
def test_find_pets_by_tags
|
18
|
+
# Parameters for the API call
|
19
|
+
tags = nil
|
20
|
+
|
21
|
+
# Perform the API call through the SDK function
|
22
|
+
result = @controller.find_pets_by_tags(tags: tags)
|
23
|
+
|
24
|
+
# Test response code
|
25
|
+
assert_equal(200, @response_catcher.response.status_code)
|
26
|
+
|
27
|
+
# Test headers
|
28
|
+
expected_headers = {}
|
29
|
+
expected_headers['content-type'] = 'application/json'
|
30
|
+
|
31
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
32
|
+
|
33
|
+
# Test whether the captured response is as we expected
|
34
|
+
refute_nil(result)
|
35
|
+
expected_body = JSON.parse(
|
36
|
+
'[{"id":10,"name":"doggie","photoUrls":["photoUrls5","photoUrls6"],"cate'\
|
37
|
+
'gory":{"id":232,"name":"name2"},"tags":[{"id":26,"name":"name0"}],"petS'\
|
38
|
+
'tatus":"sold"},{"id":11,"name":"kitty","photoUrls":["photoUrls7","photo'\
|
39
|
+
'Urls8"],"category":{"id":233,"name":"name3"},"tags":[{"id":27,"name":"n'\
|
40
|
+
'ame1"}],"petStatus":"available"}]'
|
41
|
+
)
|
42
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
43
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
44
|
+
end
|
45
|
+
|
46
|
+
# Multiple status values can be provided with comma separated strings
|
47
|
+
def test_find_pets_by_status
|
48
|
+
# Parameters for the API call
|
49
|
+
status = 'available'
|
50
|
+
|
51
|
+
# Perform the API call through the SDK function
|
52
|
+
result = @controller.find_pets_by_status(status: status)
|
53
|
+
|
54
|
+
# Test response code
|
55
|
+
assert_equal(200, @response_catcher.response.status_code)
|
56
|
+
|
57
|
+
# Test headers
|
58
|
+
expected_headers = {}
|
59
|
+
expected_headers['content-type'] = 'application/json'
|
60
|
+
|
61
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
62
|
+
|
63
|
+
# Test whether the captured response is as we expected
|
64
|
+
refute_nil(result)
|
65
|
+
expected_body = JSON.parse(
|
66
|
+
'[{"id":10,"name":"doggie","photoUrls":["photoUrls5","photoUrls6"],"cate'\
|
67
|
+
'gory":{"id":232,"name":"name2"},"tags":[{"id":26,"name":"name0"}],"petS'\
|
68
|
+
'tatus":"sold"},{"id":11,"name":"kitty","photoUrls":["photoUrls7","photo'\
|
69
|
+
'Urls8"],"category":{"id":233,"name":"name3"},"tags":[{"id":27,"name":"n'\
|
70
|
+
'ame1"}],"petStatus":"available"}]'
|
71
|
+
)
|
72
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
73
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# swagger_petstore_open_api30
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
require_relative 'controller_test_base'
|
7
|
+
|
8
|
+
class StoreControllerTests < ControllerTestBase
|
9
|
+
# Called only once for the class before any test has executed
|
10
|
+
def setup
|
11
|
+
setup_class
|
12
|
+
@controller = @client.store
|
13
|
+
@response_catcher = @controller.http_call_back
|
14
|
+
end
|
15
|
+
|
16
|
+
# Returns a map of status codes to quantities
|
17
|
+
def test_get_inventory
|
18
|
+
|
19
|
+
# Perform the API call through the SDK function
|
20
|
+
result = @controller.get_inventory()
|
21
|
+
|
22
|
+
# Test response code
|
23
|
+
assert_equal(200, @response_catcher.response.status_code)
|
24
|
+
|
25
|
+
# Test headers
|
26
|
+
expected_headers = {}
|
27
|
+
expected_headers['content-type'] = 'application/json'
|
28
|
+
|
29
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
30
|
+
end
|
31
|
+
|
32
|
+
# Place a new order in the store
|
33
|
+
def test_place_order
|
34
|
+
# Parameters for the API call
|
35
|
+
id = 10
|
36
|
+
pet_id = 198772
|
37
|
+
quantity = 7
|
38
|
+
ship_date = DateTimeHelper.from_rfc3339('2023-05-31T00:00:00Z')
|
39
|
+
order_status = 'approved'
|
40
|
+
complete = true
|
41
|
+
|
42
|
+
# Perform the API call through the SDK function
|
43
|
+
result = @controller.place_order(id: id, pet_id: pet_id, quantity: quantity,
|
44
|
+
ship_date: ship_date,
|
45
|
+
order_status: order_status,
|
46
|
+
complete: complete)
|
47
|
+
|
48
|
+
# Test response code
|
49
|
+
assert_equal(200, @response_catcher.response.status_code)
|
50
|
+
|
51
|
+
# Test headers
|
52
|
+
expected_headers = {}
|
53
|
+
expected_headers['content-type'] = 'application/json'
|
54
|
+
|
55
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# swagger_petstore_open_api30
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
require_relative 'controller_test_base'
|
7
|
+
|
8
|
+
class UserControllerTests < ControllerTestBase
|
9
|
+
# Called only once for the class before any test has executed
|
10
|
+
def setup
|
11
|
+
setup_class
|
12
|
+
@controller = @client.user
|
13
|
+
@response_catcher = @controller.http_call_back
|
14
|
+
end
|
15
|
+
|
16
|
+
# Creates list of users with given input array
|
17
|
+
def test_create_users_with_list_input
|
18
|
+
# Parameters for the API call
|
19
|
+
body = nil
|
20
|
+
|
21
|
+
# Perform the API call through the SDK function
|
22
|
+
result = @controller.create_users_with_list_input(body: body)
|
23
|
+
|
24
|
+
# Test response code
|
25
|
+
assert_equal(200, @response_catcher.response.status_code)
|
26
|
+
|
27
|
+
# Test headers
|
28
|
+
expected_headers = {}
|
29
|
+
expected_headers['content-type'] = 'application/json'
|
30
|
+
|
31
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
32
|
+
end
|
33
|
+
|
34
|
+
# Logs user into the system
|
35
|
+
def test_login_user
|
36
|
+
# Parameters for the API call
|
37
|
+
username = nil
|
38
|
+
password = nil
|
39
|
+
|
40
|
+
# Perform the API call through the SDK function
|
41
|
+
result = @controller.login_user(username: username, password: password)
|
42
|
+
|
43
|
+
# Test response code
|
44
|
+
assert_equal(200, @response_catcher.response.status_code)
|
45
|
+
|
46
|
+
# Test headers
|
47
|
+
expected_headers = {}
|
48
|
+
expected_headers['x-rate-limit'] = nil
|
49
|
+
expected_headers['x-expires-after'] = nil
|
50
|
+
expected_headers['content-type'] = 'application/json'
|
51
|
+
|
52
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# swagger_petstore_open_api30
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
class HttpResponseCatcher < SwaggerPetstoreOpenApi30::HttpCallBack
|
7
|
+
attr_accessor :response
|
8
|
+
|
9
|
+
def on_before_request(request)
|
10
|
+
end
|
11
|
+
|
12
|
+
# Catching the response
|
13
|
+
def on_after_response(response)
|
14
|
+
@response = response
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
|
metadata
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: petstore-test-sdk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- developer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-07-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: apimatic_core_interfaces
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: apimatic_core
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.3.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.3.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: apimatic_faraday_client_adapter
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.1.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.1.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.14'
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 5.14.1
|
65
|
+
type: :development
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '5.14'
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 5.14.1
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: minitest-proveit
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '1.0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '1.0'
|
89
|
+
description: use for testing
|
90
|
+
email:
|
91
|
+
- developer+sdksio@apimatic.io
|
92
|
+
executables: []
|
93
|
+
extensions: []
|
94
|
+
extra_rdoc_files: []
|
95
|
+
files:
|
96
|
+
- LICENSE
|
97
|
+
- README.md
|
98
|
+
- lib/swagger_petstore_open_api30.rb
|
99
|
+
- lib/swagger_petstore_open_api30/api_helper.rb
|
100
|
+
- lib/swagger_petstore_open_api30/client.rb
|
101
|
+
- lib/swagger_petstore_open_api30/configuration.rb
|
102
|
+
- lib/swagger_petstore_open_api30/controllers/base_controller.rb
|
103
|
+
- lib/swagger_petstore_open_api30/controllers/pet_controller.rb
|
104
|
+
- lib/swagger_petstore_open_api30/controllers/store_controller.rb
|
105
|
+
- lib/swagger_petstore_open_api30/controllers/user_controller.rb
|
106
|
+
- lib/swagger_petstore_open_api30/exceptions/api_exception.rb
|
107
|
+
- lib/swagger_petstore_open_api30/http/auth/custom_header_authentication.rb
|
108
|
+
- lib/swagger_petstore_open_api30/http/http_call_back.rb
|
109
|
+
- lib/swagger_petstore_open_api30/http/http_method_enum.rb
|
110
|
+
- lib/swagger_petstore_open_api30/http/http_request.rb
|
111
|
+
- lib/swagger_petstore_open_api30/http/http_response.rb
|
112
|
+
- lib/swagger_petstore_open_api30/models/address.rb
|
113
|
+
- lib/swagger_petstore_open_api30/models/base_model.rb
|
114
|
+
- lib/swagger_petstore_open_api30/models/category.rb
|
115
|
+
- lib/swagger_petstore_open_api30/models/customer.rb
|
116
|
+
- lib/swagger_petstore_open_api30/models/order.rb
|
117
|
+
- lib/swagger_petstore_open_api30/models/order_status_enum.rb
|
118
|
+
- lib/swagger_petstore_open_api30/models/pet.rb
|
119
|
+
- lib/swagger_petstore_open_api30/models/pet_image.rb
|
120
|
+
- lib/swagger_petstore_open_api30/models/pet_status_enum.rb
|
121
|
+
- lib/swagger_petstore_open_api30/models/status_enum.rb
|
122
|
+
- lib/swagger_petstore_open_api30/models/tag.rb
|
123
|
+
- lib/swagger_petstore_open_api30/models/user.rb
|
124
|
+
- lib/swagger_petstore_open_api30/utilities/date_time_helper.rb
|
125
|
+
- lib/swagger_petstore_open_api30/utilities/file_wrapper.rb
|
126
|
+
- test/controllers/controller_test_base.rb
|
127
|
+
- test/controllers/test_pet_controller.rb
|
128
|
+
- test/controllers/test_store_controller.rb
|
129
|
+
- test/controllers/test_user_controller.rb
|
130
|
+
- test/http_response_catcher.rb
|
131
|
+
homepage: https://www.apimatic.io
|
132
|
+
licenses:
|
133
|
+
- MIT
|
134
|
+
metadata: {}
|
135
|
+
post_install_message:
|
136
|
+
rdoc_options: []
|
137
|
+
require_paths:
|
138
|
+
- lib
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '2.6'
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
requirements: []
|
150
|
+
rubygems_version: 3.1.6
|
151
|
+
signing_key:
|
152
|
+
specification_version: 4
|
153
|
+
summary: sdks for testing
|
154
|
+
test_files: []
|