automation_test_no_submodules 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,191 @@
1
+ =begin
2
+ #Test Automation (No submodules)
3
+
4
+ #SDKs (no submodules) to test automation workflows.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ =end
8
+
9
+ require 'spec_helper'
10
+
11
+ describe AutomationTestNoSubmodules::ApiClient do
12
+ context 'initialization' do
13
+ context 'URL stuff' do
14
+ context 'host' do
15
+ it 'removes http from host' do
16
+
17
+ configuration = AutomationTestNoSubmodules::Configuration.new
18
+ configuration.host = 'http://example.com'
19
+ expect(configuration.host).to eq('example.com')
20
+ end
21
+
22
+ it 'removes https from host' do
23
+ configuration = AutomationTestNoSubmodules::Configuration.new
24
+ configuration.host = 'https://wookiee.com'
25
+ expect(configuration.host).to eq('wookiee.com')
26
+ end
27
+
28
+ it 'removes trailing path from host' do
29
+ configuration = AutomationTestNoSubmodules::Configuration.new
30
+ configuration.host = 'hello.com/v4'
31
+ expect(configuration.host).to eq('hello.com')
32
+ end
33
+ end
34
+
35
+ context 'base_path' do
36
+ it "prepends a slash to base_path" do
37
+ configuration = AutomationTestNoSubmodules::Configuration.new
38
+ configuration.base_path = 'v4/dog'
39
+ expect(configuration.base_path).to eq('/v4/dog')
40
+ end
41
+
42
+ it "doesn't prepend a slash if one is already there" do
43
+ configuration = AutomationTestNoSubmodules::Configuration.new
44
+ configuration.base_path = '/v4/dog'
45
+ expect(configuration.base_path).to eq('/v4/dog')
46
+ end
47
+
48
+ it "ends up as a blank string if nil" do
49
+ configuration = AutomationTestNoSubmodules::Configuration.new
50
+ configuration.base_path = nil
51
+ expect(configuration.base_path).to eq('')
52
+ end
53
+ end
54
+ end
55
+ end
56
+
57
+ describe '#deserialize' do
58
+ it "handles Array<Integer>" do
59
+ api_client = AutomationTestNoSubmodules::ApiClient.new
60
+ headers = { 'Content-Type' => 'application/json' }
61
+ response = double('response', headers: headers, body: '[12, 34]')
62
+ data = api_client.deserialize(response, 'Array<Integer>')
63
+ expect(data).to be_instance_of(Array)
64
+ expect(data).to eq([12, 34])
65
+ end
66
+
67
+ it 'handles Array<Array<Integer>>' do
68
+ api_client = AutomationTestNoSubmodules::ApiClient.new
69
+ headers = { 'Content-Type' => 'application/json' }
70
+ response = double('response', headers: headers, body: '[[12, 34], [56]]')
71
+ data = api_client.deserialize(response, 'Array<Array<Integer>>')
72
+ expect(data).to be_instance_of(Array)
73
+ expect(data).to eq([[12, 34], [56]])
74
+ end
75
+
76
+ it 'handles Hash<String, String>' do
77
+ api_client = AutomationTestNoSubmodules::ApiClient.new
78
+ headers = { 'Content-Type' => 'application/json' }
79
+ response = double('response', headers: headers, body: '{"message": "Hello"}')
80
+ data = api_client.deserialize(response, 'Hash<String, String>')
81
+ expect(data).to be_instance_of(Hash)
82
+ expect(data).to eq(:message => 'Hello')
83
+ end
84
+ end
85
+
86
+ describe "#object_to_hash" do
87
+ it 'ignores nils and includes empty arrays' do
88
+ # uncomment below to test object_to_hash for model
89
+ # api_client = AutomationTestNoSubmodules::ApiClient.new
90
+ # _model = AutomationTestNoSubmodules::ModelName.new
91
+ # update the model attribute below
92
+ # _model.id = 1
93
+ # update the expected value (hash) below
94
+ # expected = {id: 1, name: '', tags: []}
95
+ # expect(api_client.object_to_hash(_model)).to eq(expected)
96
+ end
97
+ end
98
+
99
+ describe '#build_collection_param' do
100
+ let(:param) { ['aa', 'bb', 'cc'] }
101
+ let(:api_client) { AutomationTestNoSubmodules::ApiClient.new }
102
+
103
+ it 'works for csv' do
104
+ expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
105
+ end
106
+
107
+ it 'works for ssv' do
108
+ expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
109
+ end
110
+
111
+ it 'works for tsv' do
112
+ expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
113
+ end
114
+
115
+ it 'works for pipes' do
116
+ expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
117
+ end
118
+
119
+ it 'works for multi' do
120
+ expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
121
+ end
122
+
123
+ it 'fails for invalid collection format' do
124
+ expect { api_client.build_collection_param(param, :INVALID) }.to raise_error(RuntimeError, 'unknown collection format: :INVALID')
125
+ end
126
+ end
127
+
128
+ describe '#json_mime?' do
129
+ let(:api_client) { AutomationTestNoSubmodules::ApiClient.new }
130
+
131
+ it 'works' do
132
+ expect(api_client.json_mime?(nil)).to eq false
133
+ expect(api_client.json_mime?('')).to eq false
134
+
135
+ expect(api_client.json_mime?('application/json')).to eq true
136
+ expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
137
+ expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
138
+
139
+ expect(api_client.json_mime?('application/xml')).to eq false
140
+ expect(api_client.json_mime?('text/plain')).to eq false
141
+ expect(api_client.json_mime?('application/jsonp')).to eq false
142
+ end
143
+ end
144
+
145
+ describe '#select_header_accept' do
146
+ let(:api_client) { AutomationTestNoSubmodules::ApiClient.new }
147
+
148
+ it 'works' do
149
+ expect(api_client.select_header_accept(nil)).to be_nil
150
+ expect(api_client.select_header_accept([])).to be_nil
151
+
152
+ expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
153
+ expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
154
+ expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
155
+
156
+ expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
157
+ expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
158
+ end
159
+ end
160
+
161
+ describe '#select_header_content_type' do
162
+ let(:api_client) { AutomationTestNoSubmodules::ApiClient.new }
163
+
164
+ it 'works' do
165
+ expect(api_client.select_header_content_type(nil)).to be_nil
166
+ expect(api_client.select_header_content_type([])).to be_nil
167
+
168
+ expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
169
+ expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
170
+ expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
171
+ expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
172
+ expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
173
+ end
174
+ end
175
+
176
+ describe '#sanitize_filename' do
177
+ let(:api_client) { AutomationTestNoSubmodules::ApiClient.new }
178
+
179
+ it 'works' do
180
+ expect(api_client.sanitize_filename('sun')).to eq('sun')
181
+ expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
182
+ expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
183
+ expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
184
+ expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
185
+ expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
186
+ expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
187
+ expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
188
+ expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
189
+ end
190
+ end
191
+ end
@@ -0,0 +1,38 @@
1
+ =begin
2
+ #Test Automation (No submodules)
3
+
4
+ #SDKs (no submodules) to test automation workflows.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ =end
8
+
9
+ require 'spec_helper'
10
+
11
+ describe AutomationTestNoSubmodules::Configuration do
12
+ let(:config) { AutomationTestNoSubmodules::Configuration.default }
13
+
14
+ before(:each) do
15
+ # uncomment below to setup host and base_path
16
+ # require 'URI'
17
+ # uri = URI.parse("http://google.com")
18
+ # AutomationTestNoSubmodules.configure do |c|
19
+ # c.host = uri.host
20
+ # c.base_path = uri.path
21
+ # end
22
+ end
23
+
24
+ describe '#base_url' do
25
+ it 'should have the default value' do
26
+ # uncomment below to test default value of the base path
27
+ # expect(config.base_url).to eq("http://google.com")
28
+ end
29
+
30
+ it 'should remove trailing slashes' do
31
+ [nil, '', '/', '//'].each do |base_path|
32
+ config.base_path = base_path
33
+ # uncomment below to test trailing slashes
34
+ # expect(config.base_url).to eq("http://google.com")
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,34 @@
1
+ =begin
2
+ #Test Automation (No submodules)
3
+
4
+ #SDKs (no submodules) to test automation workflows.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ =end
8
+
9
+ require 'spec_helper'
10
+ require 'json'
11
+ require 'date'
12
+
13
+ # Unit tests for AutomationTestNoSubmodules::HelloResponse
14
+ describe AutomationTestNoSubmodules::HelloResponse do
15
+ let(:instance) { AutomationTestNoSubmodules::HelloResponse.new }
16
+
17
+ describe 'test an instance of HelloResponse' do
18
+ it 'should create an instance of HelloResponse' do
19
+ expect(instance).to be_instance_of(AutomationTestNoSubmodules::HelloResponse)
20
+ end
21
+ end
22
+ describe 'test attribute "message"' do
23
+ it 'should work' do
24
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
25
+ end
26
+ end
27
+
28
+ describe 'test attribute "value"' do
29
+ it 'should work' do
30
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
31
+ end
32
+ end
33
+
34
+ end
@@ -0,0 +1,107 @@
1
+ =begin
2
+ #Test Automation (No submodules)
3
+
4
+ #SDKs (no submodules) to test automation workflows.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ =end
8
+
9
+ # load the gem
10
+ require 'automation_test_no_submodules'
11
+
12
+ # The following was generated by the `rspec --init` command. Conventionally, all
13
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
14
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
15
+ # this file to always be loaded, without a need to explicitly require it in any
16
+ # files.
17
+ #
18
+ # Given that it is always loaded, you are encouraged to keep this file as
19
+ # light-weight as possible. Requiring heavyweight dependencies from this file
20
+ # will add to the boot time of your test suite on EVERY test run, even for an
21
+ # individual file that may not need all of that loaded. Instead, consider making
22
+ # a separate helper file that requires the additional dependencies and performs
23
+ # the additional setup, and require it from the spec files that actually need
24
+ # it.
25
+ #
26
+ # The `.rspec` file also contains a few flags that are not defaults but that
27
+ # users commonly want.
28
+ #
29
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
30
+ RSpec.configure do |config|
31
+ # rspec-expectations config goes here. You can use an alternate
32
+ # assertion/expectation library such as wrong or the stdlib/minitest
33
+ # assertions if you prefer.
34
+ config.expect_with :rspec do |expectations|
35
+ # This option will default to `true` in RSpec 4. It makes the `description`
36
+ # and `failure_message` of custom matchers include text for helper methods
37
+ # defined using `chain`, e.g.:
38
+ # be_bigger_than(2).and_smaller_than(4).description
39
+ # # => "be bigger than 2 and smaller than 4"
40
+ # ...rather than:
41
+ # # => "be bigger than 2"
42
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
43
+ end
44
+
45
+ # rspec-mocks config goes here. You can use an alternate test double
46
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
47
+ config.mock_with :rspec do |mocks|
48
+ # Prevents you from mocking or stubbing a method that does not exist on
49
+ # a real object. This is generally recommended, and will default to
50
+ # `true` in RSpec 4.
51
+ mocks.verify_partial_doubles = true
52
+ end
53
+
54
+ # The settings below are suggested to provide a good initial experience
55
+ # with RSpec, but feel free to customize to your heart's content.
56
+ =begin
57
+ # These two settings work together to allow you to limit a spec run
58
+ # to individual examples or groups you care about by tagging them with
59
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
60
+ # get run.
61
+ config.filter_run :focus
62
+ config.run_all_when_everything_filtered = true
63
+
64
+ # Allows RSpec to persist some state between runs in order to support
65
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
66
+ # you configure your source control system to ignore this file.
67
+ config.example_status_persistence_file_path = "spec/examples.txt"
68
+
69
+ # Limits the available syntax to the non-monkey patched syntax that is
70
+ # recommended. For more details, see:
71
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
72
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
73
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
74
+ config.disable_monkey_patching!
75
+
76
+ # This setting enables warnings. It's recommended, but in some cases may
77
+ # be too noisy due to issues in dependencies.
78
+ config.warnings = true
79
+
80
+ # Many RSpec users commonly either run the entire suite or an individual
81
+ # file, and it's useful to allow more verbose output when running an
82
+ # individual spec file.
83
+ if config.files_to_run.one?
84
+ # Use the documentation formatter for detailed output,
85
+ # unless a formatter has already been configured
86
+ # (e.g. via a command-line flag).
87
+ config.default_formatter = 'doc'
88
+ end
89
+
90
+ # Print the 10 slowest examples and example groups at the
91
+ # end of the spec run, to help surface which specs are running
92
+ # particularly slow.
93
+ config.profile_examples = 10
94
+
95
+ # Run specs in random order to surface order dependencies. If you find an
96
+ # order dependency and want to debug it, you can fix the order by providing
97
+ # the seed, which is printed after each run.
98
+ # --seed 1234
99
+ config.order = :random
100
+
101
+ # Seed global randomization in this process using the `--seed` CLI option.
102
+ # Setting this allows you to use `--seed` to deterministically reproduce
103
+ # test failures related to randomization by passing the same `--seed` value
104
+ # as the one that triggered the failure.
105
+ Kernel.srand config.seed
106
+ =end
107
+ end
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: automation_test_no_submodules
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Konfig
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-07-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.1
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '3.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.1
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '3.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: faraday-multipart
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.0'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.0.4
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '1.0'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.0.4
53
+ - !ruby/object:Gem::Dependency
54
+ name: rspec
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '3.6'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 3.6.0
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '3.6'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 3.6.0
73
+ description: SDKs (no submodules) to test automation workflows.
74
+ email:
75
+ - engineering@konfigthis.com
76
+ executables: []
77
+ extensions: []
78
+ extra_rdoc_files: []
79
+ files:
80
+ - Gemfile
81
+ - Gemfile.lock
82
+ - README.md
83
+ - Rakefile
84
+ - automation_test_no_submodules.gemspec
85
+ - lib/automation_test_no_submodules.rb
86
+ - lib/automation_test_no_submodules/api/greetings_api.rb
87
+ - lib/automation_test_no_submodules/api_client.rb
88
+ - lib/automation_test_no_submodules/api_client_custom.rb
89
+ - lib/automation_test_no_submodules/api_error.rb
90
+ - lib/automation_test_no_submodules/configuration.rb
91
+ - lib/automation_test_no_submodules/models/hello_response.rb
92
+ - lib/automation_test_no_submodules/version.rb
93
+ - spec/api/greetings_api_spec.rb
94
+ - spec/api_client_spec.rb
95
+ - spec/configuration_spec.rb
96
+ - spec/models/hello_response_spec.rb
97
+ - spec/spec_helper.rb
98
+ homepage: https://konfigthis.com
99
+ licenses:
100
+ - MIT
101
+ metadata:
102
+ documentation_uri: https://github.com/eddiechayes/automation-test/tree/main/ruby
103
+ source_code_uri: https://github.com/eddiechayes/automation-test/tree/main/ruby
104
+ post_install_message:
105
+ rdoc_options: []
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '2.4'
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ requirements: []
119
+ rubygems_version: 3.4.10
120
+ signing_key:
121
+ specification_version: 4
122
+ summary: Test Automation (No submodules) Ruby Gem
123
+ test_files:
124
+ - spec/api/greetings_api_spec.rb
125
+ - spec/api_client_spec.rb
126
+ - spec/configuration_spec.rb
127
+ - spec/models/hello_response_spec.rb
128
+ - spec/spec_helper.rb