pulp_npm_client 0.1.0a4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -10
- data/docs/AsyncOperationResponse.md +8 -7
- data/docs/ContentPackagesApi.md +126 -64
- data/docs/ContentSummaryResponse.md +12 -11
- data/docs/DistributionsNpmApi.md +362 -93
- data/docs/NpmNpmDistribution.md +18 -15
- data/docs/NpmNpmDistributionResponse.md +30 -21
- data/docs/NpmNpmRemote.md +48 -47
- data/docs/NpmNpmRemoteResponse.md +48 -43
- data/docs/NpmNpmRemoteResponseHiddenFieldsInner.md +20 -0
- data/docs/NpmNpmRepository.md +16 -15
- data/docs/NpmNpmRepositoryResponse.md +28 -23
- data/docs/NpmPackageResponse.md +22 -17
- data/docs/PaginatedRepositoryVersionResponseList.md +14 -13
- data/docs/PaginatednpmNpmDistributionResponseList.md +14 -13
- data/docs/PaginatednpmNpmRemoteResponseList.md +14 -13
- data/docs/PaginatednpmNpmRepositoryResponseList.md +14 -13
- data/docs/PaginatednpmPackageResponseList.md +14 -13
- data/docs/PatchednpmNpmDistribution.md +18 -15
- data/docs/PatchednpmNpmRemote.md +48 -47
- data/docs/PatchednpmNpmRepository.md +16 -15
- data/docs/PolicyEnum.md +4 -5
- data/docs/RemotesNpmApi.md +364 -99
- data/docs/Repair.md +8 -7
- data/docs/RepositoriesNpmApi.md +429 -110
- data/docs/RepositoriesNpmVersionsApi.md +156 -80
- data/docs/RepositoryAddRemoveContent.md +12 -11
- data/docs/RepositorySyncURL.md +10 -9
- data/docs/RepositoryVersionResponse.md +22 -17
- data/docs/SetLabel.md +20 -0
- data/docs/SetLabelResponse.md +20 -0
- data/docs/UnsetLabel.md +18 -0
- data/docs/UnsetLabelResponse.md +20 -0
- data/lib/pulp_npm_client/api/content_packages_api.rb +72 -44
- data/lib/pulp_npm_client/api/distributions_npm_api.rb +243 -47
- data/lib/pulp_npm_client/api/remotes_npm_api.rb +247 -57
- data/lib/pulp_npm_client/api/repositories_npm_api.rb +283 -55
- data/lib/pulp_npm_client/api/repositories_npm_versions_api.rb +71 -52
- data/lib/pulp_npm_client/api_client.rb +137 -102
- data/lib/pulp_npm_client/api_error.rb +2 -1
- data/lib/pulp_npm_client/configuration.rb +163 -22
- data/lib/pulp_npm_client/models/async_operation_response.rb +32 -22
- data/lib/pulp_npm_client/models/content_summary_response.rb +36 -22
- data/lib/pulp_npm_client/models/npm_npm_distribution.rb +51 -25
- data/lib/pulp_npm_client/models/npm_npm_distribution_response.rb +83 -27
- data/lib/pulp_npm_client/models/npm_npm_remote.rb +61 -25
- data/lib/pulp_npm_client/models/npm_npm_remote_response.rb +99 -41
- data/lib/pulp_npm_client/models/npm_npm_remote_response_hidden_fields_inner.rb +237 -0
- data/lib/pulp_npm_client/models/npm_npm_repository.rb +37 -25
- data/lib/pulp_npm_client/models/npm_npm_repository_response.rb +59 -27
- data/lib/pulp_npm_client/models/npm_package_response.rb +58 -24
- data/lib/pulp_npm_client/models/paginated_repository_version_response_list.rb +44 -22
- data/lib/pulp_npm_client/models/paginatednpm_npm_distribution_response_list.rb +44 -22
- data/lib/pulp_npm_client/models/paginatednpm_npm_remote_response_list.rb +44 -22
- data/lib/pulp_npm_client/models/paginatednpm_npm_repository_response_list.rb +44 -22
- data/lib/pulp_npm_client/models/paginatednpm_package_response_list.rb +44 -22
- data/lib/pulp_npm_client/models/patchednpm_npm_distribution.rb +57 -27
- data/lib/pulp_npm_client/models/patchednpm_npm_remote.rb +67 -27
- data/lib/pulp_npm_client/models/patchednpm_npm_repository.rb +40 -26
- data/lib/pulp_npm_client/models/policy_enum.rb +8 -4
- data/lib/pulp_npm_client/models/repair.rb +30 -22
- data/lib/pulp_npm_client/models/repository_add_remove_content.rb +33 -25
- data/lib/pulp_npm_client/models/repository_sync_url.rb +30 -22
- data/lib/pulp_npm_client/models/repository_version_response.rb +53 -25
- data/lib/pulp_npm_client/models/set_label.rb +264 -0
- data/lib/pulp_npm_client/models/set_label_response.rb +255 -0
- data/lib/pulp_npm_client/models/unset_label.rb +252 -0
- data/lib/pulp_npm_client/models/unset_label_response.rb +252 -0
- data/lib/pulp_npm_client/version.rb +2 -2
- data/lib/pulp_npm_client.rb +6 -3
- data/pulp_npm_client.gemspec +10 -7
- data/spec/api/content_packages_api_spec.rb +22 -16
- data/spec/api/distributions_npm_api_spec.rb +51 -14
- data/spec/api/remotes_npm_api_spec.rb +54 -19
- data/spec/api/repositories_npm_api_spec.rb +60 -15
- data/spec/api/repositories_npm_versions_api_spec.rb +23 -19
- data/spec/models/async_operation_response_spec.rb +7 -12
- data/spec/models/content_summary_response_spec.rb +9 -14
- data/spec/models/npm_npm_distribution_response_spec.rb +38 -19
- data/spec/models/npm_npm_distribution_spec.rb +17 -16
- data/spec/models/npm_npm_remote_response_hidden_fields_inner_spec.rb +42 -0
- data/spec/models/npm_npm_remote_response_spec.rb +42 -35
- data/spec/models/npm_npm_remote_spec.rb +27 -32
- data/spec/models/npm_npm_repository_response_spec.rb +27 -20
- data/spec/models/npm_npm_repository_spec.rb +11 -16
- data/spec/models/npm_package_response_spec.rb +24 -17
- data/spec/models/paginated_repository_version_response_list_spec.rb +10 -15
- data/spec/models/paginatednpm_npm_distribution_response_list_spec.rb +10 -15
- data/spec/models/paginatednpm_npm_remote_response_list_spec.rb +10 -15
- data/spec/models/paginatednpm_npm_repository_response_list_spec.rb +10 -15
- data/spec/models/paginatednpm_package_response_list_spec.rb +10 -15
- data/spec/models/patchednpm_npm_distribution_spec.rb +17 -16
- data/spec/models/patchednpm_npm_remote_spec.rb +27 -32
- data/spec/models/patchednpm_npm_repository_spec.rb +11 -16
- data/spec/models/policy_enum_spec.rb +6 -11
- data/spec/models/repair_spec.rb +7 -12
- data/spec/models/repository_add_remove_content_spec.rb +9 -14
- data/spec/models/repository_sync_url_spec.rb +8 -13
- data/spec/models/repository_version_response_spec.rb +24 -17
- data/spec/models/set_label_response_spec.rb +42 -0
- data/spec/models/set_label_spec.rb +42 -0
- data/spec/models/unset_label_response_spec.rb +42 -0
- data/spec/models/unset_label_spec.rb +36 -0
- data/spec/spec_helper.rb +1 -1
- metadata +94 -59
- data/docs/NpmPackage.md +0 -29
- data/docs/PulpNpmPackagesApi.md +0 -60
- data/git_push.sh +0 -58
- data/lib/pulp_npm_client/api/pulp_npm_packages_api.rb +0 -86
- data/lib/pulp_npm_client/models/npm_package.rb +0 -337
- data/spec/api/pulp_npm_packages_api_spec.rb +0 -48
- data/spec/api_client_spec.rb +0 -188
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/npm_package_spec.rb +0 -77
@@ -1,337 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Pulp 3 API
|
3
|
-
|
4
|
-
#Fetch, Upload, Organize, and Distribute Software Packages
|
5
|
-
|
6
|
-
The version of the OpenAPI document: v3
|
7
|
-
Contact: pulp-list@redhat.com
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.3.1
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
|
15
|
-
module PulpNpmClient
|
16
|
-
# A Serializer for Package. Add serializers for the new fields defined in Package and add those fields to the Meta class keeping fields from the parent class as well. For example:: field1 = serializers.TextField() field2 = serializers.IntegerField() field3 = serializers.CharField() class Meta: fields = platform.SingleArtifactContentSerializer.Meta.fields + ( 'field1', 'field2', 'field3' ) model = models.Package
|
17
|
-
class NpmPackage
|
18
|
-
# Artifact file representing the physical content
|
19
|
-
attr_accessor :artifact
|
20
|
-
|
21
|
-
attr_accessor :relative_path
|
22
|
-
|
23
|
-
# An uploaded file that may be turned into the artifact of the content unit.
|
24
|
-
attr_accessor :file
|
25
|
-
|
26
|
-
# A URI of a repository the new content unit should be associated with.
|
27
|
-
attr_accessor :repository
|
28
|
-
|
29
|
-
# An uncommitted upload that may be turned into the artifact of the content unit.
|
30
|
-
attr_accessor :upload
|
31
|
-
|
32
|
-
attr_accessor :name
|
33
|
-
|
34
|
-
attr_accessor :version
|
35
|
-
|
36
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
37
|
-
def self.attribute_map
|
38
|
-
{
|
39
|
-
:'artifact' => :'artifact',
|
40
|
-
:'relative_path' => :'relative_path',
|
41
|
-
:'file' => :'file',
|
42
|
-
:'repository' => :'repository',
|
43
|
-
:'upload' => :'upload',
|
44
|
-
:'name' => :'name',
|
45
|
-
:'version' => :'version'
|
46
|
-
}
|
47
|
-
end
|
48
|
-
|
49
|
-
# Attribute type mapping.
|
50
|
-
def self.openapi_types
|
51
|
-
{
|
52
|
-
:'artifact' => :'String',
|
53
|
-
:'relative_path' => :'String',
|
54
|
-
:'file' => :'File',
|
55
|
-
:'repository' => :'String',
|
56
|
-
:'upload' => :'String',
|
57
|
-
:'name' => :'String',
|
58
|
-
:'version' => :'String'
|
59
|
-
}
|
60
|
-
end
|
61
|
-
|
62
|
-
# List of attributes with nullable: true
|
63
|
-
def self.openapi_nullable
|
64
|
-
Set.new([
|
65
|
-
])
|
66
|
-
end
|
67
|
-
|
68
|
-
# Initializes the object
|
69
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
70
|
-
def initialize(attributes = {})
|
71
|
-
if (!attributes.is_a?(Hash))
|
72
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpNpmClient::NpmPackage` initialize method"
|
73
|
-
end
|
74
|
-
|
75
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
76
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
77
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
78
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpNpmClient::NpmPackage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
79
|
-
end
|
80
|
-
h[k.to_sym] = v
|
81
|
-
}
|
82
|
-
|
83
|
-
if attributes.key?(:'artifact')
|
84
|
-
self.artifact = attributes[:'artifact']
|
85
|
-
end
|
86
|
-
|
87
|
-
if attributes.key?(:'relative_path')
|
88
|
-
self.relative_path = attributes[:'relative_path']
|
89
|
-
end
|
90
|
-
|
91
|
-
if attributes.key?(:'file')
|
92
|
-
self.file = attributes[:'file']
|
93
|
-
end
|
94
|
-
|
95
|
-
if attributes.key?(:'repository')
|
96
|
-
self.repository = attributes[:'repository']
|
97
|
-
end
|
98
|
-
|
99
|
-
if attributes.key?(:'upload')
|
100
|
-
self.upload = attributes[:'upload']
|
101
|
-
end
|
102
|
-
|
103
|
-
if attributes.key?(:'name')
|
104
|
-
self.name = attributes[:'name']
|
105
|
-
end
|
106
|
-
|
107
|
-
if attributes.key?(:'version')
|
108
|
-
self.version = attributes[:'version']
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
113
|
-
# @return Array for valid properties with the reasons
|
114
|
-
def list_invalid_properties
|
115
|
-
invalid_properties = Array.new
|
116
|
-
if @relative_path.nil?
|
117
|
-
invalid_properties.push('invalid value for "relative_path", relative_path cannot be nil.')
|
118
|
-
end
|
119
|
-
|
120
|
-
if @relative_path.to_s.length < 1
|
121
|
-
invalid_properties.push('invalid value for "relative_path", the character length must be great than or equal to 1.')
|
122
|
-
end
|
123
|
-
|
124
|
-
if @name.nil?
|
125
|
-
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
126
|
-
end
|
127
|
-
|
128
|
-
if @name.to_s.length < 1
|
129
|
-
invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
|
130
|
-
end
|
131
|
-
|
132
|
-
if @version.nil?
|
133
|
-
invalid_properties.push('invalid value for "version", version cannot be nil.')
|
134
|
-
end
|
135
|
-
|
136
|
-
if @version.to_s.length < 1
|
137
|
-
invalid_properties.push('invalid value for "version", the character length must be great than or equal to 1.')
|
138
|
-
end
|
139
|
-
|
140
|
-
invalid_properties
|
141
|
-
end
|
142
|
-
|
143
|
-
# Check to see if the all the properties in the model are valid
|
144
|
-
# @return true if the model is valid
|
145
|
-
def valid?
|
146
|
-
return false if @relative_path.nil?
|
147
|
-
return false if @relative_path.to_s.length < 1
|
148
|
-
return false if @name.nil?
|
149
|
-
return false if @name.to_s.length < 1
|
150
|
-
return false if @version.nil?
|
151
|
-
return false if @version.to_s.length < 1
|
152
|
-
true
|
153
|
-
end
|
154
|
-
|
155
|
-
# Custom attribute writer method with validation
|
156
|
-
# @param [Object] relative_path Value to be assigned
|
157
|
-
def relative_path=(relative_path)
|
158
|
-
if relative_path.nil?
|
159
|
-
fail ArgumentError, 'relative_path cannot be nil'
|
160
|
-
end
|
161
|
-
|
162
|
-
if relative_path.to_s.length < 1
|
163
|
-
fail ArgumentError, 'invalid value for "relative_path", the character length must be great than or equal to 1.'
|
164
|
-
end
|
165
|
-
|
166
|
-
@relative_path = relative_path
|
167
|
-
end
|
168
|
-
|
169
|
-
# Custom attribute writer method with validation
|
170
|
-
# @param [Object] name Value to be assigned
|
171
|
-
def name=(name)
|
172
|
-
if name.nil?
|
173
|
-
fail ArgumentError, 'name cannot be nil'
|
174
|
-
end
|
175
|
-
|
176
|
-
if name.to_s.length < 1
|
177
|
-
fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
|
178
|
-
end
|
179
|
-
|
180
|
-
@name = name
|
181
|
-
end
|
182
|
-
|
183
|
-
# Custom attribute writer method with validation
|
184
|
-
# @param [Object] version Value to be assigned
|
185
|
-
def version=(version)
|
186
|
-
if version.nil?
|
187
|
-
fail ArgumentError, 'version cannot be nil'
|
188
|
-
end
|
189
|
-
|
190
|
-
if version.to_s.length < 1
|
191
|
-
fail ArgumentError, 'invalid value for "version", the character length must be great than or equal to 1.'
|
192
|
-
end
|
193
|
-
|
194
|
-
@version = version
|
195
|
-
end
|
196
|
-
|
197
|
-
# Checks equality by comparing each attribute.
|
198
|
-
# @param [Object] Object to be compared
|
199
|
-
def ==(o)
|
200
|
-
return true if self.equal?(o)
|
201
|
-
self.class == o.class &&
|
202
|
-
artifact == o.artifact &&
|
203
|
-
relative_path == o.relative_path &&
|
204
|
-
file == o.file &&
|
205
|
-
repository == o.repository &&
|
206
|
-
upload == o.upload &&
|
207
|
-
name == o.name &&
|
208
|
-
version == o.version
|
209
|
-
end
|
210
|
-
|
211
|
-
# @see the `==` method
|
212
|
-
# @param [Object] Object to be compared
|
213
|
-
def eql?(o)
|
214
|
-
self == o
|
215
|
-
end
|
216
|
-
|
217
|
-
# Calculates hash code according to all attributes.
|
218
|
-
# @return [Integer] Hash code
|
219
|
-
def hash
|
220
|
-
[artifact, relative_path, file, repository, upload, name, version].hash
|
221
|
-
end
|
222
|
-
|
223
|
-
# Builds the object from hash
|
224
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
225
|
-
# @return [Object] Returns the model itself
|
226
|
-
def self.build_from_hash(attributes)
|
227
|
-
new.build_from_hash(attributes)
|
228
|
-
end
|
229
|
-
|
230
|
-
# Builds the object from hash
|
231
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
232
|
-
# @return [Object] Returns the model itself
|
233
|
-
def build_from_hash(attributes)
|
234
|
-
return nil unless attributes.is_a?(Hash)
|
235
|
-
self.class.openapi_types.each_pair do |key, type|
|
236
|
-
if type =~ /\AArray<(.*)>/i
|
237
|
-
# check to ensure the input is an array given that the attribute
|
238
|
-
# is documented as an array but the input is not
|
239
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
240
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
241
|
-
end
|
242
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
243
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
244
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
245
|
-
end
|
246
|
-
|
247
|
-
self
|
248
|
-
end
|
249
|
-
|
250
|
-
# Deserializes the data based on type
|
251
|
-
# @param string type Data type
|
252
|
-
# @param string value Value to be deserialized
|
253
|
-
# @return [Object] Deserialized data
|
254
|
-
def _deserialize(type, value)
|
255
|
-
case type.to_sym
|
256
|
-
when :DateTime
|
257
|
-
DateTime.parse(value)
|
258
|
-
when :Date
|
259
|
-
Date.parse(value)
|
260
|
-
when :String
|
261
|
-
value.to_s
|
262
|
-
when :Integer
|
263
|
-
value.to_i
|
264
|
-
when :Float
|
265
|
-
value.to_f
|
266
|
-
when :Boolean
|
267
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
268
|
-
true
|
269
|
-
else
|
270
|
-
false
|
271
|
-
end
|
272
|
-
when :Object
|
273
|
-
# generic object (usually a Hash), return directly
|
274
|
-
value
|
275
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
276
|
-
inner_type = Regexp.last_match[:inner_type]
|
277
|
-
value.map { |v| _deserialize(inner_type, v) }
|
278
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
279
|
-
k_type = Regexp.last_match[:k_type]
|
280
|
-
v_type = Regexp.last_match[:v_type]
|
281
|
-
{}.tap do |hash|
|
282
|
-
value.each do |k, v|
|
283
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
284
|
-
end
|
285
|
-
end
|
286
|
-
else # model
|
287
|
-
PulpNpmClient.const_get(type).build_from_hash(value)
|
288
|
-
end
|
289
|
-
end
|
290
|
-
|
291
|
-
# Returns the string representation of the object
|
292
|
-
# @return [String] String presentation of the object
|
293
|
-
def to_s
|
294
|
-
to_hash.to_s
|
295
|
-
end
|
296
|
-
|
297
|
-
# to_body is an alias to to_hash (backward compatibility)
|
298
|
-
# @return [Hash] Returns the object in the form of hash
|
299
|
-
def to_body
|
300
|
-
to_hash
|
301
|
-
end
|
302
|
-
|
303
|
-
# Returns the object in the form of hash
|
304
|
-
# @return [Hash] Returns the object in the form of hash
|
305
|
-
def to_hash
|
306
|
-
hash = {}
|
307
|
-
self.class.attribute_map.each_pair do |attr, param|
|
308
|
-
value = self.send(attr)
|
309
|
-
if value.nil?
|
310
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
311
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
312
|
-
end
|
313
|
-
|
314
|
-
hash[param] = _to_hash(value)
|
315
|
-
end
|
316
|
-
hash
|
317
|
-
end
|
318
|
-
|
319
|
-
# Outputs non-array value in the form of hash
|
320
|
-
# For object, use to_hash. Otherwise, just return the value
|
321
|
-
# @param [Object] value Any valid value
|
322
|
-
# @return [Hash] Returns the value in the form of hash
|
323
|
-
def _to_hash(value)
|
324
|
-
if value.is_a?(Array)
|
325
|
-
value.compact.map { |v| _to_hash(v) }
|
326
|
-
elsif value.is_a?(Hash)
|
327
|
-
{}.tap do |hash|
|
328
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
329
|
-
end
|
330
|
-
elsif value.respond_to? :to_hash
|
331
|
-
value.to_hash
|
332
|
-
else
|
333
|
-
value
|
334
|
-
end
|
335
|
-
end
|
336
|
-
end
|
337
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Pulp 3 API
|
3
|
-
|
4
|
-
#Fetch, Upload, Organize, and Distribute Software Packages
|
5
|
-
|
6
|
-
The version of the OpenAPI document: v3
|
7
|
-
Contact: pulp-list@redhat.com
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.3.1
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'spec_helper'
|
14
|
-
require 'json'
|
15
|
-
|
16
|
-
# Unit tests for PulpNpmClient::PulpNpmPackagesApi
|
17
|
-
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
-
# Please update as you see appropriate
|
19
|
-
describe 'PulpNpmPackagesApi' do
|
20
|
-
before do
|
21
|
-
# run before each test
|
22
|
-
@api_instance = PulpNpmClient::PulpNpmPackagesApi.new
|
23
|
-
end
|
24
|
-
|
25
|
-
after do
|
26
|
-
# run after each test
|
27
|
-
end
|
28
|
-
|
29
|
-
describe 'test an instance of PulpNpmPackagesApi' do
|
30
|
-
it 'should create an instance of PulpNpmPackagesApi' do
|
31
|
-
expect(@api_instance).to be_instance_of(PulpNpmClient::PulpNpmPackagesApi)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# unit tests for get
|
36
|
-
# Return a published package.
|
37
|
-
# @param name
|
38
|
-
# @param [Hash] opts the optional parameters
|
39
|
-
# @option opts [String] :fields A list of fields to include in the response.
|
40
|
-
# @option opts [String] :exclude_fields A list of fields to exclude from the response.
|
41
|
-
# @return [nil]
|
42
|
-
describe 'get test' do
|
43
|
-
it 'should work' do
|
44
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
data/spec/api_client_spec.rb
DELETED
@@ -1,188 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Pulp 3 API
|
3
|
-
|
4
|
-
#Fetch, Upload, Organize, and Distribute Software Packages
|
5
|
-
|
6
|
-
The version of the OpenAPI document: v3
|
7
|
-
Contact: pulp-list@redhat.com
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.3.1
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'spec_helper'
|
14
|
-
|
15
|
-
describe PulpNpmClient::ApiClient do
|
16
|
-
context 'initialization' do
|
17
|
-
context 'URL stuff' do
|
18
|
-
context 'host' do
|
19
|
-
it 'removes http from host' do
|
20
|
-
PulpNpmClient.configure { |c| c.host = 'http://example.com' }
|
21
|
-
expect(PulpNpmClient::Configuration.default.host).to eq('example.com')
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'removes https from host' do
|
25
|
-
PulpNpmClient.configure { |c| c.host = 'https://wookiee.com' }
|
26
|
-
expect(PulpNpmClient::ApiClient.default.config.host).to eq('wookiee.com')
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'removes trailing path from host' do
|
30
|
-
PulpNpmClient.configure { |c| c.host = 'hobo.com/v4' }
|
31
|
-
expect(PulpNpmClient::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
|
-
PulpNpmClient.configure { |c| c.base_path = 'v4/dog' }
|
38
|
-
expect(PulpNpmClient::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
|
-
PulpNpmClient.configure { |c| c.base_path = '/v4/dog' }
|
43
|
-
expect(PulpNpmClient::Configuration.default.base_path).to eq('/v4/dog')
|
44
|
-
end
|
45
|
-
|
46
|
-
it "ends up as a blank string if nil" do
|
47
|
-
PulpNpmClient.configure { |c| c.base_path = nil }
|
48
|
-
expect(PulpNpmClient::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 = PulpNpmClient::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 = PulpNpmClient::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 = PulpNpmClient::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 = PulpNpmClient::ApiClient.new
|
87
|
-
# _model = PulpNpmClient::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) { PulpNpmClient::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) { PulpNpmClient::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) { PulpNpmClient::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) { PulpNpmClient::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) { PulpNpmClient::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
|
data/spec/configuration_spec.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Pulp 3 API
|
3
|
-
|
4
|
-
#Fetch, Upload, Organize, and Distribute Software Packages
|
5
|
-
|
6
|
-
The version of the OpenAPI document: v3
|
7
|
-
Contact: pulp-list@redhat.com
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.3.1
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'spec_helper'
|
14
|
-
|
15
|
-
describe PulpNpmClient::Configuration do
|
16
|
-
let(:config) { PulpNpmClient::Configuration.default }
|
17
|
-
|
18
|
-
before(:each) do
|
19
|
-
# uncomment below to setup host and base_path
|
20
|
-
# require 'URI'
|
21
|
-
# uri = URI.parse("https://pulp")
|
22
|
-
# PulpNpmClient.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("https://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("https://pulp")
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Pulp 3 API
|
3
|
-
|
4
|
-
#Fetch, Upload, Organize, and Distribute Software Packages
|
5
|
-
|
6
|
-
The version of the OpenAPI document: v3
|
7
|
-
Contact: pulp-list@redhat.com
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.3.1
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'spec_helper'
|
14
|
-
require 'json'
|
15
|
-
require 'date'
|
16
|
-
|
17
|
-
# Unit tests for PulpNpmClient::NpmPackage
|
18
|
-
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
19
|
-
# Please update as you see appropriate
|
20
|
-
describe 'NpmPackage' do
|
21
|
-
before do
|
22
|
-
# run before each test
|
23
|
-
@instance = PulpNpmClient::NpmPackage.new
|
24
|
-
end
|
25
|
-
|
26
|
-
after do
|
27
|
-
# run after each test
|
28
|
-
end
|
29
|
-
|
30
|
-
describe 'test an instance of NpmPackage' do
|
31
|
-
it 'should create an instance of NpmPackage' do
|
32
|
-
expect(@instance).to be_instance_of(PulpNpmClient::NpmPackage)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
describe 'test attribute "artifact"' do
|
36
|
-
it 'should work' do
|
37
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe 'test attribute "relative_path"' 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
|
-
describe 'test attribute "file"' do
|
48
|
-
it 'should work' do
|
49
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe 'test attribute "repository"' 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
|
-
describe 'test attribute "upload"' do
|
60
|
-
it 'should work' do
|
61
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe 'test attribute "name"' do
|
66
|
-
it 'should work' do
|
67
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
describe 'test attribute "version"' 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
|
-
end
|