pulp_python_client 3.0.0b9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +175 -0
- data/Rakefile +10 -0
- data/docs/AsyncOperationResponse.md +17 -0
- data/docs/ContentPackagesApi.md +262 -0
- data/docs/ContentSummary.md +21 -0
- data/docs/DistributionsPypiApi.md +364 -0
- data/docs/InlineResponse200.md +23 -0
- data/docs/InlineResponse2001.md +23 -0
- data/docs/InlineResponse2002.md +23 -0
- data/docs/InlineResponse2003.md +23 -0
- data/docs/InlineResponse2004.md +23 -0
- data/docs/InlineResponse2005.md +23 -0
- data/docs/ProjectSpecifier.md +19 -0
- data/docs/PublicationsPypiApi.md +253 -0
- data/docs/PythonPythonDistribution.md +29 -0
- data/docs/PythonPythonDistributionRead.md +29 -0
- data/docs/PythonPythonPackageContentRead.md +69 -0
- data/docs/PythonPythonPublication.md +25 -0
- data/docs/PythonPythonPublicationRead.md +25 -0
- data/docs/PythonPythonRemote.md +49 -0
- data/docs/PythonPythonRemoteRead.md +49 -0
- data/docs/PythonPythonRepository.md +27 -0
- data/docs/PythonPythonRepositoryRead.md +27 -0
- data/docs/RemotesPythonApi.md +368 -0
- data/docs/RepositoriesPythonApi.md +468 -0
- data/docs/RepositoriesPythonVersionsApi.md +269 -0
- data/docs/RepositoryAddRemoveContent.md +21 -0
- data/docs/RepositorySyncURL.md +19 -0
- data/docs/RepositoryVersion.md +25 -0
- data/docs/RepositoryVersionRead.md +25 -0
- data/git_push.sh +58 -0
- data/lib/pulp_python_client.rb +67 -0
- data/lib/pulp_python_client/api/content_packages_api.rb +349 -0
- data/lib/pulp_python_client/api/distributions_pypi_api.rb +445 -0
- data/lib/pulp_python_client/api/publications_pypi_api.rb +306 -0
- data/lib/pulp_python_client/api/remotes_python_api.rb +451 -0
- data/lib/pulp_python_client/api/repositories_python_api.rb +573 -0
- data/lib/pulp_python_client/api/repositories_python_versions_api.rb +336 -0
- data/lib/pulp_python_client/api_client.rb +402 -0
- data/lib/pulp_python_client/api_error.rb +57 -0
- data/lib/pulp_python_client/configuration.rb +243 -0
- data/lib/pulp_python_client/models/async_operation_response.rb +212 -0
- data/lib/pulp_python_client/models/content_summary.rb +246 -0
- data/lib/pulp_python_client/models/inline_response200.rb +247 -0
- data/lib/pulp_python_client/models/inline_response2001.rb +247 -0
- data/lib/pulp_python_client/models/inline_response2002.rb +247 -0
- data/lib/pulp_python_client/models/inline_response2003.rb +247 -0
- data/lib/pulp_python_client/models/inline_response2004.rb +247 -0
- data/lib/pulp_python_client/models/inline_response2005.rb +247 -0
- data/lib/pulp_python_client/models/project_specifier.rb +242 -0
- data/lib/pulp_python_client/models/python_python_distribution.rb +331 -0
- data/lib/pulp_python_client/models/python_python_distribution_read.rb +331 -0
- data/lib/pulp_python_client/models/python_python_package_content_read.rb +550 -0
- data/lib/pulp_python_client/models/python_python_publication.rb +247 -0
- data/lib/pulp_python_client/models/python_python_publication_read.rb +247 -0
- data/lib/pulp_python_client/models/python_python_remote.rb +565 -0
- data/lib/pulp_python_client/models/python_python_remote_read.rb +565 -0
- data/lib/pulp_python_client/models/python_python_repository.rb +294 -0
- data/lib/pulp_python_client/models/python_python_repository_read.rb +294 -0
- data/lib/pulp_python_client/models/repository_add_remove_content.rb +231 -0
- data/lib/pulp_python_client/models/repository_sync_url.rb +224 -0
- data/lib/pulp_python_client/models/repository_version.rb +244 -0
- data/lib/pulp_python_client/models/repository_version_read.rb +244 -0
- data/lib/pulp_python_client/version.rb +15 -0
- data/pulp_python_client.gemspec +39 -0
- data/spec/api/content_packages_api_spec.rb +114 -0
- data/spec/api/distributions_pypi_api_spec.rb +121 -0
- data/spec/api/publications_pypi_api_spec.rb +96 -0
- data/spec/api/remotes_python_api_spec.rb +123 -0
- data/spec/api/repositories_python_api_spec.rb +143 -0
- data/spec/api/repositories_python_versions_api_spec.rb +103 -0
- data/spec/api_client_spec.rb +188 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/async_operation_response_spec.rb +41 -0
- data/spec/models/content_summary_spec.rb +53 -0
- data/spec/models/inline_response2001_spec.rb +59 -0
- data/spec/models/inline_response2002_spec.rb +59 -0
- data/spec/models/inline_response2003_spec.rb +59 -0
- data/spec/models/inline_response2004_spec.rb +59 -0
- data/spec/models/inline_response2005_spec.rb +59 -0
- data/spec/models/inline_response200_spec.rb +59 -0
- data/spec/models/project_specifier_spec.rb +47 -0
- data/spec/models/python_python_distribution_read_spec.rb +77 -0
- data/spec/models/python_python_distribution_spec.rb +77 -0
- data/spec/models/python_python_package_content_read_spec.rb +197 -0
- data/spec/models/python_python_publication_read_spec.rb +65 -0
- data/spec/models/python_python_publication_spec.rb +65 -0
- data/spec/models/python_python_remote_read_spec.rb +141 -0
- data/spec/models/python_python_remote_spec.rb +141 -0
- data/spec/models/python_python_repository_read_spec.rb +71 -0
- data/spec/models/python_python_repository_spec.rb +71 -0
- data/spec/models/repository_add_remove_content_spec.rb +53 -0
- data/spec/models/repository_sync_url_spec.rb +47 -0
- data/spec/models/repository_version_read_spec.rb +65 -0
- data/spec/models/repository_version_spec.rb +65 -0
- data/spec/spec_helper.rb +111 -0
- metadata +225 -0
@@ -0,0 +1,143 @@
|
|
1
|
+
=begin
|
2
|
+
#Pulp 3 API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.2.3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for PulpPythonClient::RepositoriesPythonApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'RepositoriesPythonApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = PulpPythonClient::RepositoriesPythonApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of RepositoriesPythonApi' do
|
30
|
+
it 'should create an instance of RepositoriesPythonApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(PulpPythonClient::RepositoriesPythonApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for create
|
36
|
+
# Create a python repository
|
37
|
+
# A ViewSet for PythonRepository.
|
38
|
+
# @param data
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @return [PythonPythonRepositoryRead]
|
41
|
+
describe 'create test' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# unit tests for delete
|
48
|
+
# Delete a python repository
|
49
|
+
# Trigger an asynchronous delete task
|
50
|
+
# @param python_repository_href URI of Python Repository. e.g.: /pulp/api/v3/repositories/python/python/1/
|
51
|
+
# @param [Hash] opts the optional parameters
|
52
|
+
# @return [AsyncOperationResponse]
|
53
|
+
describe 'delete test' do
|
54
|
+
it 'should work' do
|
55
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# unit tests for list
|
60
|
+
# List python repositorys
|
61
|
+
# A ViewSet for PythonRepository.
|
62
|
+
# @param [Hash] opts the optional parameters
|
63
|
+
# @option opts [String] :ordering Which field to use when ordering the results.
|
64
|
+
# @option opts [String] :name
|
65
|
+
# @option opts [String] :name__in Filter results where name is in a comma-separated list of values
|
66
|
+
# @option opts [Integer] :limit Number of results to return per page.
|
67
|
+
# @option opts [Integer] :offset The initial index from which to return the results.
|
68
|
+
# @option opts [String] :fields A list of fields to include in the response.
|
69
|
+
# @option opts [String] :exclude_fields A list of fields to exclude from the response.
|
70
|
+
# @return [InlineResponse2004]
|
71
|
+
describe 'list test' do
|
72
|
+
it 'should work' do
|
73
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# unit tests for modify
|
78
|
+
# Modify Repository Content
|
79
|
+
# Trigger an asynchronous task to create a new repository version.
|
80
|
+
# @param python_repository_href URI of Python Repository. e.g.: /pulp/api/v3/repositories/python/python/1/
|
81
|
+
# @param data
|
82
|
+
# @param [Hash] opts the optional parameters
|
83
|
+
# @return [AsyncOperationResponse]
|
84
|
+
describe 'modify test' do
|
85
|
+
it 'should work' do
|
86
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# unit tests for partial_update
|
91
|
+
# Partially update a python repository
|
92
|
+
# Trigger an asynchronous partial update task
|
93
|
+
# @param python_repository_href URI of Python Repository. e.g.: /pulp/api/v3/repositories/python/python/1/
|
94
|
+
# @param data
|
95
|
+
# @param [Hash] opts the optional parameters
|
96
|
+
# @return [AsyncOperationResponse]
|
97
|
+
describe 'partial_update test' do
|
98
|
+
it 'should work' do
|
99
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# unit tests for read
|
104
|
+
# Inspect a python repository
|
105
|
+
# A ViewSet for PythonRepository.
|
106
|
+
# @param python_repository_href URI of Python Repository. e.g.: /pulp/api/v3/repositories/python/python/1/
|
107
|
+
# @param [Hash] opts the optional parameters
|
108
|
+
# @option opts [String] :fields A list of fields to include in the response.
|
109
|
+
# @option opts [String] :exclude_fields A list of fields to exclude from the response.
|
110
|
+
# @return [PythonPythonRepositoryRead]
|
111
|
+
describe 'read test' do
|
112
|
+
it 'should work' do
|
113
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# unit tests for sync
|
118
|
+
# Sync from remote
|
119
|
+
# Trigger an asynchronous task to sync Python content.
|
120
|
+
# @param python_repository_href URI of Python Repository. e.g.: /pulp/api/v3/repositories/python/python/1/
|
121
|
+
# @param data
|
122
|
+
# @param [Hash] opts the optional parameters
|
123
|
+
# @return [AsyncOperationResponse]
|
124
|
+
describe 'sync test' do
|
125
|
+
it 'should work' do
|
126
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# unit tests for update
|
131
|
+
# Update a python repository
|
132
|
+
# Trigger an asynchronous update task
|
133
|
+
# @param python_repository_href URI of Python Repository. e.g.: /pulp/api/v3/repositories/python/python/1/
|
134
|
+
# @param data
|
135
|
+
# @param [Hash] opts the optional parameters
|
136
|
+
# @return [AsyncOperationResponse]
|
137
|
+
describe 'update test' do
|
138
|
+
it 'should work' do
|
139
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
=begin
|
2
|
+
#Pulp 3 API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.2.3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for PulpPythonClient::RepositoriesPythonVersionsApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'RepositoriesPythonVersionsApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = PulpPythonClient::RepositoriesPythonVersionsApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of RepositoriesPythonVersionsApi' do
|
30
|
+
it 'should create an instance of RepositoriesPythonVersionsApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(PulpPythonClient::RepositoriesPythonVersionsApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for delete
|
36
|
+
# Delete a repository version
|
37
|
+
# Trigger an asynchronous task to delete a repositroy version.
|
38
|
+
# @param python_repository_version_href URI of Repository Version. e.g.: /pulp/api/v3/repositories/python/python/1/versions/1/
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @return [AsyncOperationResponse]
|
41
|
+
describe 'delete test' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# unit tests for list
|
48
|
+
# List repository versions
|
49
|
+
# PythonRepositoryVersion represents a single Python repository version.
|
50
|
+
# @param python_repository_href URI of Python Repository. e.g.: /pulp/api/v3/repositories/python/python/1/
|
51
|
+
# @param [Hash] opts the optional parameters
|
52
|
+
# @option opts [String] :ordering Which field to use when ordering the results.
|
53
|
+
# @option opts [Float] :number
|
54
|
+
# @option opts [Float] :number__lt Filter results where number is less than value
|
55
|
+
# @option opts [Float] :number__lte Filter results where number is less than or equal to value
|
56
|
+
# @option opts [Float] :number__gt Filter results where number is greater than value
|
57
|
+
# @option opts [Float] :number__gte Filter results where number is greater than or equal to value
|
58
|
+
# @option opts [Float] :number__range Filter results where number is between two comma separated values
|
59
|
+
# @option opts [String] :pulp_created__lt Filter results where pulp_created is less than value
|
60
|
+
# @option opts [String] :pulp_created__lte Filter results where pulp_created is less than or equal to value
|
61
|
+
# @option opts [String] :pulp_created__gt Filter results where pulp_created is greater than value
|
62
|
+
# @option opts [String] :pulp_created__gte Filter results where pulp_created is greater than or equal to value
|
63
|
+
# @option opts [String] :pulp_created__range Filter results where pulp_created is between two comma separated values
|
64
|
+
# @option opts [String] :content Content Unit referenced by HREF
|
65
|
+
# @option opts [String] :pulp_created ISO 8601 formatted dates are supported
|
66
|
+
# @option opts [Integer] :limit Number of results to return per page.
|
67
|
+
# @option opts [Integer] :offset The initial index from which to return the results.
|
68
|
+
# @option opts [String] :fields A list of fields to include in the response.
|
69
|
+
# @option opts [String] :exclude_fields A list of fields to exclude from the response.
|
70
|
+
# @return [InlineResponse2005]
|
71
|
+
describe 'list test' do
|
72
|
+
it 'should work' do
|
73
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# unit tests for read
|
78
|
+
# Inspect a repository version
|
79
|
+
# PythonRepositoryVersion represents a single Python repository version.
|
80
|
+
# @param python_repository_version_href URI of Repository Version. e.g.: /pulp/api/v3/repositories/python/python/1/versions/1/
|
81
|
+
# @param [Hash] opts the optional parameters
|
82
|
+
# @option opts [String] :fields A list of fields to include in the response.
|
83
|
+
# @option opts [String] :exclude_fields A list of fields to exclude from the response.
|
84
|
+
# @return [RepositoryVersionRead]
|
85
|
+
describe 'read test' do
|
86
|
+
it 'should work' do
|
87
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# unit tests for repair
|
92
|
+
# Trigger an asynchronous task to repair a repositroy version.
|
93
|
+
# @param python_repository_version_href URI of Repository Version. e.g.: /pulp/api/v3/repositories/python/python/1/versions/1/
|
94
|
+
# @param data
|
95
|
+
# @param [Hash] opts the optional parameters
|
96
|
+
# @return [AsyncOperationResponse]
|
97
|
+
describe 'repair test' do
|
98
|
+
it 'should work' do
|
99
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
@@ -0,0 +1,188 @@
|
|
1
|
+
=begin
|
2
|
+
#Pulp 3 API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.2.3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
|
15
|
+
describe PulpPythonClient::ApiClient do
|
16
|
+
context 'initialization' do
|
17
|
+
context 'URL stuff' do
|
18
|
+
context 'host' do
|
19
|
+
it 'removes http from host' do
|
20
|
+
PulpPythonClient.configure { |c| c.host = 'http://example.com' }
|
21
|
+
expect(PulpPythonClient::Configuration.default.host).to eq('example.com')
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'removes https from host' do
|
25
|
+
PulpPythonClient.configure { |c| c.host = 'https://wookiee.com' }
|
26
|
+
expect(PulpPythonClient::ApiClient.default.config.host).to eq('wookiee.com')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'removes trailing path from host' do
|
30
|
+
PulpPythonClient.configure { |c| c.host = 'hobo.com/v4' }
|
31
|
+
expect(PulpPythonClient::Configuration.default.host).to eq('hobo.com')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'base_path' do
|
36
|
+
it "prepends a slash to base_path" do
|
37
|
+
PulpPythonClient.configure { |c| c.base_path = 'v4/dog' }
|
38
|
+
expect(PulpPythonClient::Configuration.default.base_path).to eq('/v4/dog')
|
39
|
+
end
|
40
|
+
|
41
|
+
it "doesn't prepend a slash if one is already there" do
|
42
|
+
PulpPythonClient.configure { |c| c.base_path = '/v4/dog' }
|
43
|
+
expect(PulpPythonClient::Configuration.default.base_path).to eq('/v4/dog')
|
44
|
+
end
|
45
|
+
|
46
|
+
it "ends up as a blank string if nil" do
|
47
|
+
PulpPythonClient.configure { |c| c.base_path = nil }
|
48
|
+
expect(PulpPythonClient::Configuration.default.base_path).to eq('')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#deserialize' do
|
55
|
+
it "handles Array<Integer>" do
|
56
|
+
api_client = PulpPythonClient::ApiClient.new
|
57
|
+
headers = { 'Content-Type' => 'application/json' }
|
58
|
+
response = double('response', headers: headers, body: '[12, 34]')
|
59
|
+
data = api_client.deserialize(response, 'Array<Integer>')
|
60
|
+
expect(data).to be_instance_of(Array)
|
61
|
+
expect(data).to eq([12, 34])
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'handles Array<Array<Integer>>' do
|
65
|
+
api_client = PulpPythonClient::ApiClient.new
|
66
|
+
headers = { 'Content-Type' => 'application/json' }
|
67
|
+
response = double('response', headers: headers, body: '[[12, 34], [56]]')
|
68
|
+
data = api_client.deserialize(response, 'Array<Array<Integer>>')
|
69
|
+
expect(data).to be_instance_of(Array)
|
70
|
+
expect(data).to eq([[12, 34], [56]])
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'handles Hash<String, String>' do
|
74
|
+
api_client = PulpPythonClient::ApiClient.new
|
75
|
+
headers = { 'Content-Type' => 'application/json' }
|
76
|
+
response = double('response', headers: headers, body: '{"message": "Hello"}')
|
77
|
+
data = api_client.deserialize(response, 'Hash<String, String>')
|
78
|
+
expect(data).to be_instance_of(Hash)
|
79
|
+
expect(data).to eq(:message => 'Hello')
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe "#object_to_hash" do
|
84
|
+
it 'ignores nils and includes empty arrays' do
|
85
|
+
# uncomment below to test object_to_hash for model
|
86
|
+
# api_client = PulpPythonClient::ApiClient.new
|
87
|
+
# _model = PulpPythonClient::ModelName.new
|
88
|
+
# update the model attribute below
|
89
|
+
# _model.id = 1
|
90
|
+
# update the expected value (hash) below
|
91
|
+
# expected = {id: 1, name: '', tags: []}
|
92
|
+
# expect(api_client.object_to_hash(_model)).to eq(expected)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
describe '#build_collection_param' do
|
97
|
+
let(:param) { ['aa', 'bb', 'cc'] }
|
98
|
+
let(:api_client) { PulpPythonClient::ApiClient.new }
|
99
|
+
|
100
|
+
it 'works for csv' do
|
101
|
+
expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'works for ssv' do
|
105
|
+
expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'works for tsv' do
|
109
|
+
expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'works for pipes' do
|
113
|
+
expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'works for multi' do
|
117
|
+
expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'fails for invalid collection format' do
|
121
|
+
expect{api_client.build_collection_param(param, :INVALID)}.to raise_error(RuntimeError, 'unknown collection format: :INVALID')
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
describe '#json_mime?' do
|
126
|
+
let(:api_client) { PulpPythonClient::ApiClient.new }
|
127
|
+
|
128
|
+
it 'works' do
|
129
|
+
expect(api_client.json_mime?(nil)).to eq false
|
130
|
+
expect(api_client.json_mime?('')).to eq false
|
131
|
+
|
132
|
+
expect(api_client.json_mime?('application/json')).to eq true
|
133
|
+
expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
|
134
|
+
expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
|
135
|
+
|
136
|
+
expect(api_client.json_mime?('application/xml')).to eq false
|
137
|
+
expect(api_client.json_mime?('text/plain')).to eq false
|
138
|
+
expect(api_client.json_mime?('application/jsonp')).to eq false
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
describe '#select_header_accept' do
|
143
|
+
let(:api_client) { PulpPythonClient::ApiClient.new }
|
144
|
+
|
145
|
+
it 'works' do
|
146
|
+
expect(api_client.select_header_accept(nil)).to be_nil
|
147
|
+
expect(api_client.select_header_accept([])).to be_nil
|
148
|
+
|
149
|
+
expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
|
150
|
+
expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
151
|
+
expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
152
|
+
|
153
|
+
expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
|
154
|
+
expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
describe '#select_header_content_type' do
|
159
|
+
let(:api_client) { PulpPythonClient::ApiClient.new }
|
160
|
+
|
161
|
+
it 'works' do
|
162
|
+
expect(api_client.select_header_content_type(nil)).to eq('application/json')
|
163
|
+
expect(api_client.select_header_content_type([])).to eq('application/json')
|
164
|
+
|
165
|
+
expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
|
166
|
+
expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
167
|
+
expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
168
|
+
expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
|
169
|
+
expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
describe '#sanitize_filename' do
|
174
|
+
let(:api_client) { PulpPythonClient::ApiClient.new }
|
175
|
+
|
176
|
+
it 'works' do
|
177
|
+
expect(api_client.sanitize_filename('sun')).to eq('sun')
|
178
|
+
expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
|
179
|
+
expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
|
180
|
+
expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
|
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('c:\var\tmp\sun.gif')).to eq('sun.gif')
|
185
|
+
expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
=begin
|
2
|
+
#Pulp 3 API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.2.3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
|
15
|
+
describe PulpPythonClient::Configuration do
|
16
|
+
let(:config) { PulpPythonClient::Configuration.default }
|
17
|
+
|
18
|
+
before(:each) do
|
19
|
+
# uncomment below to setup host and base_path
|
20
|
+
# require 'URI'
|
21
|
+
# uri = URI.parse("http://pulp")
|
22
|
+
# PulpPythonClient.configure do |c|
|
23
|
+
# c.host = uri.host
|
24
|
+
# c.base_path = uri.path
|
25
|
+
# end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#base_url' do
|
29
|
+
it 'should have the default value' do
|
30
|
+
# uncomment below to test default value of the base path
|
31
|
+
# expect(config.base_url).to eq("http://pulp")
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should remove trailing slashes' do
|
35
|
+
[nil, '', '/', '//'].each do |base_path|
|
36
|
+
config.base_path = base_path
|
37
|
+
# uncomment below to test trailing slashes
|
38
|
+
# expect(config.base_url).to eq("http://pulp")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|