pdc 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/examples/pdc_push_target.rb +19 -0
- data/lib/pdc/v1.rb +1 -0
- data/lib/pdc/v1/multi_destination.rb +1 -1
- data/lib/pdc/v1/push_target.rb +5 -0
- data/lib/pdc/v1/release_rpm_mapping.rb +1 -1
- data/lib/pdc/version.rb +1 -1
- data/spec/fixtures/vcr/can_find_push_target_by_description.yml +45 -0
- data/spec/fixtures/vcr/can_find_push_target_by_service.yml +46 -0
- data/spec/fixtures/vcr/destination_returns_count.yml +1 -1
- data/spec/fixtures/vcr/destination_works_with_where.yml +1 -1
- data/spec/fixtures/vcr/must_has_compose.yml +1 -1
- data/spec/fixtures/vcr/push_target_returns_count.yml +46 -0
- data/spec/fixtures/vcr/push_target_works_with_where.yml +45 -0
- data/spec/pdc/v1/{multi_destination_sepc.rb → multi_destination_spec.rb} +3 -3
- data/spec/pdc/v1/push_target_spec.rb +42 -0
- data/spec/support/fixtures.rb +7 -0
- metadata +16 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d44458984f2174c95997fe585cd6a08606fe879
|
4
|
+
data.tar.gz: f64b204a96e85954dc2826dca3bd257e8df89e24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ced404dedc88d2e6a10e4ebfdfd491868629a30b2f82ca4b6694ecb06a70e070e87a6c9e113c4a052fb61189346d669496e6884afbe0350888cee7622657b8a8
|
7
|
+
data.tar.gz: 0051fc5d3e91be748f4e4617425ed7a5c491549a9aea037f8872345a2c350ff89db28cc3e58cf26472e288db060b47617d20656ee64ef282dad528c557b93b93
|
data/Gemfile
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require './lib/pdc'
|
4
|
+
|
5
|
+
def main
|
6
|
+
PDC.configure do |config|
|
7
|
+
config.site = 'https://example.com/'
|
8
|
+
config.log_level = :debug
|
9
|
+
config.disable_caching = true
|
10
|
+
config.requires_token = false
|
11
|
+
end
|
12
|
+
|
13
|
+
push_target = PDC::V1::PushTarget.where(
|
14
|
+
name: 'cdn-qa'
|
15
|
+
).find_one!
|
16
|
+
puts push_target.description
|
17
|
+
end
|
18
|
+
|
19
|
+
main if $PROGRAM_NAME == __FILE__
|
data/lib/pdc/v1.rb
CHANGED
data/lib/pdc/version.rb
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://example.com/rest_api/v1/push%2Dtargets/?description=CDN+qa
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
User-Agent:
|
15
|
+
- Faraday v0.9.2
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message:
|
20
|
+
headers:
|
21
|
+
date:
|
22
|
+
- Mon, 29 Jan 2018 03:34:55 GMT
|
23
|
+
server:
|
24
|
+
- WSGIServer/0.1 Python/2.7.14
|
25
|
+
expires:
|
26
|
+
- Mon, 29 Jan 2018 03:35:25 GMT
|
27
|
+
vary:
|
28
|
+
- Accept, Cookie
|
29
|
+
last-modified:
|
30
|
+
- Mon, 29 Jan 2018 03:34:55 GMT
|
31
|
+
allow:
|
32
|
+
- GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
|
33
|
+
cache-control:
|
34
|
+
- max-age=30
|
35
|
+
x-frame-options:
|
36
|
+
- SAMEORIGIN
|
37
|
+
content-type:
|
38
|
+
- application/json
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '{"count":1,"next":null,"previous":null,"results":[{"id":1,"name":"cdn-qa","description":"CDN
|
42
|
+
qa","service":"pulp","host":"https://example-host.com"}]}'
|
43
|
+
http_version:
|
44
|
+
recorded_at: Mon, 29 Jan 2018 03:34:55 GMT
|
45
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://example.com/rest_api/v1/push%2Dtargets/?service=pulp&service=rhn
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
User-Agent:
|
15
|
+
- Faraday v0.9.2
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message:
|
20
|
+
headers:
|
21
|
+
date:
|
22
|
+
- Mon, 29 Jan 2018 03:34:55 GMT
|
23
|
+
server:
|
24
|
+
- WSGIServer/0.1 Python/2.7.14
|
25
|
+
expires:
|
26
|
+
- Mon, 29 Jan 2018 03:35:25 GMT
|
27
|
+
vary:
|
28
|
+
- Accept, Cookie
|
29
|
+
last-modified:
|
30
|
+
- Mon, 29 Jan 2018 03:34:55 GMT
|
31
|
+
allow:
|
32
|
+
- GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
|
33
|
+
cache-control:
|
34
|
+
- max-age=30
|
35
|
+
x-frame-options:
|
36
|
+
- SAMEORIGIN
|
37
|
+
content-type:
|
38
|
+
- application/json
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '{"count":2,"next":null,"previous":null,"results":[{"id":1,"name":"cdn-qa","description":"CDN
|
42
|
+
qa","service":"pulp","host":"https://example-host.com"},{"id":2,"name":"rhn-qa","description":"RHN
|
43
|
+
qa","service":"rhn","host":"https://example-host.com"}]}'
|
44
|
+
http_version:
|
45
|
+
recorded_at: Mon, 29 Jan 2018 03:34:55 GMT
|
46
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://example.com/rest_api/v1/push%2Dtargets/
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
User-Agent:
|
15
|
+
- Faraday v0.9.2
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message:
|
20
|
+
headers:
|
21
|
+
date:
|
22
|
+
- Mon, 29 Jan 2018 03:34:55 GMT
|
23
|
+
server:
|
24
|
+
- WSGIServer/0.1 Python/2.7.14
|
25
|
+
expires:
|
26
|
+
- Mon, 29 Jan 2018 03:35:25 GMT
|
27
|
+
vary:
|
28
|
+
- Accept, Cookie
|
29
|
+
last-modified:
|
30
|
+
- Mon, 29 Jan 2018 03:34:55 GMT
|
31
|
+
allow:
|
32
|
+
- GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
|
33
|
+
cache-control:
|
34
|
+
- max-age=30
|
35
|
+
x-frame-options:
|
36
|
+
- SAMEORIGIN
|
37
|
+
content-type:
|
38
|
+
- application/json
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '{"count":2,"next":null,"previous":null,"results":[{"id":1,"name":"cdn-qa","description":"CDN
|
42
|
+
qa","service":"pulp","host":"https://example-host.com"},{"id":2,"name":"rhn-qa","description":"RHN
|
43
|
+
qa","service":"rhn","host":"https://example-host.com"}]}'
|
44
|
+
http_version:
|
45
|
+
recorded_at: Mon, 29 Jan 2018 03:34:55 GMT
|
46
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://example.com/rest_api/v1/push%2Dtargets/?name=cdn-qa
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
User-Agent:
|
15
|
+
- Faraday v0.9.2
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message:
|
20
|
+
headers:
|
21
|
+
date:
|
22
|
+
- Mon, 29 Jan 2018 03:34:55 GMT
|
23
|
+
server:
|
24
|
+
- WSGIServer/0.1 Python/2.7.14
|
25
|
+
expires:
|
26
|
+
- Mon, 29 Jan 2018 03:35:25 GMT
|
27
|
+
vary:
|
28
|
+
- Accept, Cookie
|
29
|
+
last-modified:
|
30
|
+
- Mon, 29 Jan 2018 03:34:55 GMT
|
31
|
+
allow:
|
32
|
+
- GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
|
33
|
+
cache-control:
|
34
|
+
- max-age=30
|
35
|
+
x-frame-options:
|
36
|
+
- SAMEORIGIN
|
37
|
+
content-type:
|
38
|
+
- application/json
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '{"count":1,"next":null,"previous":null,"results":[{"id":1,"name":"cdn-qa","description":"CDN
|
42
|
+
qa","service":"pulp","host":"https://example-host.com"}]}'
|
43
|
+
http_version:
|
44
|
+
recorded_at: Mon, 29 Jan 2018 03:34:55 GMT
|
45
|
+
recorded_with: VCR 4.0.0
|
@@ -11,16 +11,16 @@ describe PDC::V1::MultiDestination do
|
|
11
11
|
VCR.eject_cassette
|
12
12
|
end
|
13
13
|
|
14
|
-
let(:
|
14
|
+
let(:multi_destinations) { PDC::V1::MultiDestination }
|
15
15
|
|
16
16
|
describe 'count' do
|
17
17
|
it 'destination returns count' do
|
18
|
-
count =
|
18
|
+
count = multi_destinations.count
|
19
19
|
count.must_equal 1
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'destination works with where' do
|
23
|
-
count =
|
23
|
+
count = multi_destinations.where(active: false).count
|
24
24
|
count.must_equal 0
|
25
25
|
end
|
26
26
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe PDC::V1::PushTarget do
|
4
|
+
before do
|
5
|
+
VCR.insert_cassette fixture_name
|
6
|
+
end
|
7
|
+
|
8
|
+
after do
|
9
|
+
VCR.eject_cassette
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:push_target) { PDC::V1::PushTarget }
|
13
|
+
|
14
|
+
describe 'count' do
|
15
|
+
it 'push_target returns count' do
|
16
|
+
count = push_target.count
|
17
|
+
count.must_equal 2
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'push_target works with where' do
|
21
|
+
count = push_target.where(name: 'cdn-qa').count
|
22
|
+
count.must_equal 1
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'can find push_target by description' do
|
26
|
+
count = push_target.where(description: 'CDN qa').count
|
27
|
+
count.must_equal 1
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'can find push_target by service' do
|
31
|
+
count = push_target.where(service: %w[pulp rhn]).count
|
32
|
+
count.must_equal 2
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '#push_target' do
|
37
|
+
it 'returns push_target for name' do
|
38
|
+
pt = push_target.where(name: 'cdn-qa')
|
39
|
+
pt.wont_be_nil
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/spec/support/fixtures.rb
CHANGED
@@ -137,5 +137,12 @@ module Fixtures
|
|
137
137
|
|
138
138
|
class Release < Association
|
139
139
|
self.primary_key = :release_id
|
140
|
+
|
141
|
+
attributes :short, :version, :name, :base_product,
|
142
|
+
:active, :product_version, :release_type,
|
143
|
+
:compose_set, :integrated_with, :bugzilla,
|
144
|
+
:dist_git, :brew, :product_pages, :errata,
|
145
|
+
:sigkey, :allow_buildroot_push,
|
146
|
+
:allowed_debuginfo_services, :allowed_push_targets
|
140
147
|
end
|
141
148
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sunil Thaha
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-03-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -163,6 +163,7 @@ files:
|
|
163
163
|
- examples/logger.rb
|
164
164
|
- examples/pdc_curb_access_token.rb
|
165
165
|
- examples/pdc_global_component_contact.rb
|
166
|
+
- examples/pdc_push_target.rb
|
166
167
|
- examples/pdc_release_rpm_mapping.rb
|
167
168
|
- examples/pdc_resource_tests.rb
|
168
169
|
- examples/pdc_test_cache.rb
|
@@ -213,6 +214,7 @@ files:
|
|
213
214
|
- lib/pdc/v1/global_component_contact.rb
|
214
215
|
- lib/pdc/v1/multi_destination.rb
|
215
216
|
- lib/pdc/v1/product.rb
|
217
|
+
- lib/pdc/v1/push_target.rb
|
216
218
|
- lib/pdc/v1/release.rb
|
217
219
|
- lib/pdc/v1/release_rpm_mapping.rb
|
218
220
|
- lib/pdc/v1/release_variant.rb
|
@@ -229,6 +231,8 @@ files:
|
|
229
231
|
- spec/fixtures/vcr/caches_response_with_multiple_query.yml
|
230
232
|
- spec/fixtures/vcr/caches_response_without_query.yml
|
231
233
|
- spec/fixtures/vcr/can_find_global_contact_by_component_name.yml
|
234
|
+
- spec/fixtures/vcr/can_find_push_target_by_description.yml
|
235
|
+
- spec/fixtures/vcr/can_find_push_target_by_service.yml
|
232
236
|
- spec/fixtures/vcr/can_get_release_by_multi_product_version.yml
|
233
237
|
- spec/fixtures/vcr/can_iterate_using_each.yml
|
234
238
|
- spec/fixtures/vcr/content_delivery_repos_must_return_a_record.yml
|
@@ -246,6 +250,8 @@ files:
|
|
246
250
|
- spec/fixtures/vcr/must_has_version__attributes.yml
|
247
251
|
- spec/fixtures/vcr/must_return_number_of_resources.yml
|
248
252
|
- spec/fixtures/vcr/preserves_the_filters.yml
|
253
|
+
- spec/fixtures/vcr/push_target_returns_count.yml
|
254
|
+
- spec/fixtures/vcr/push_target_works_with_where.yml
|
249
255
|
- spec/fixtures/vcr/returns_a_contact_email.yml
|
250
256
|
- spec/fixtures/vcr/returns_a_gloabl_contact_id.yml
|
251
257
|
- spec/fixtures/vcr/returns_a_mail_name.yml
|
@@ -277,7 +283,8 @@ files:
|
|
277
283
|
- spec/pdc/v1/arch_spec.rb
|
278
284
|
- spec/pdc/v1/content_delivery_repo_spec.rb
|
279
285
|
- spec/pdc/v1/global_component_contact_spec.rb
|
280
|
-
- spec/pdc/v1/
|
286
|
+
- spec/pdc/v1/multi_destination_spec.rb
|
287
|
+
- spec/pdc/v1/push_target_spec.rb
|
281
288
|
- spec/pdc/v1/release_rpm_mapping_spec.rb
|
282
289
|
- spec/pdc/v1/release_spec.rb
|
283
290
|
- spec/pdc/v1/release_variant_spec.rb
|
@@ -323,6 +330,8 @@ test_files:
|
|
323
330
|
- spec/fixtures/vcr/caches_response_with_multiple_query.yml
|
324
331
|
- spec/fixtures/vcr/caches_response_without_query.yml
|
325
332
|
- spec/fixtures/vcr/can_find_global_contact_by_component_name.yml
|
333
|
+
- spec/fixtures/vcr/can_find_push_target_by_description.yml
|
334
|
+
- spec/fixtures/vcr/can_find_push_target_by_service.yml
|
326
335
|
- spec/fixtures/vcr/can_get_release_by_multi_product_version.yml
|
327
336
|
- spec/fixtures/vcr/can_iterate_using_each.yml
|
328
337
|
- spec/fixtures/vcr/content_delivery_repos_must_return_a_record.yml
|
@@ -340,6 +349,8 @@ test_files:
|
|
340
349
|
- spec/fixtures/vcr/must_has_version__attributes.yml
|
341
350
|
- spec/fixtures/vcr/must_return_number_of_resources.yml
|
342
351
|
- spec/fixtures/vcr/preserves_the_filters.yml
|
352
|
+
- spec/fixtures/vcr/push_target_returns_count.yml
|
353
|
+
- spec/fixtures/vcr/push_target_works_with_where.yml
|
343
354
|
- spec/fixtures/vcr/returns_a_contact_email.yml
|
344
355
|
- spec/fixtures/vcr/returns_a_gloabl_contact_id.yml
|
345
356
|
- spec/fixtures/vcr/returns_a_mail_name.yml
|
@@ -371,7 +382,8 @@ test_files:
|
|
371
382
|
- spec/pdc/v1/arch_spec.rb
|
372
383
|
- spec/pdc/v1/content_delivery_repo_spec.rb
|
373
384
|
- spec/pdc/v1/global_component_contact_spec.rb
|
374
|
-
- spec/pdc/v1/
|
385
|
+
- spec/pdc/v1/multi_destination_spec.rb
|
386
|
+
- spec/pdc/v1/push_target_spec.rb
|
375
387
|
- spec/pdc/v1/release_rpm_mapping_spec.rb
|
376
388
|
- spec/pdc/v1/release_spec.rb
|
377
389
|
- spec/pdc/v1/release_variant_spec.rb
|