runcible 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/lib/runcible/version.rb +1 -1
  2. metadata +8 -153
  3. data/.gitignore +0 -18
  4. data/Gemfile +0 -19
  5. data/LICENSE +0 -22
  6. data/README.md +0 -29
  7. data/Rakefile +0 -37
  8. data/rel-eng/packages/.readme +0 -3
  9. data/rel-eng/packages/rubygem-runcible +0 -1
  10. data/rel-eng/tito.props +0 -5
  11. data/runcible.gemspec +0 -17
  12. data/runcible.spec +0 -66
  13. data/test/.gitkeep +0 -0
  14. data/test/integration/extensions/repository_test.rb +0 -117
  15. data/test/integration/fixtures/repositories/zoo5/.treeinfo +0 -12
  16. data/test/integration/fixtures/repositories/zoo5/CHANGESET +0 -11
  17. data/test/integration/fixtures/repositories/zoo5/PULP_MANIFEST +0 -1
  18. data/test/integration/fixtures/repositories/zoo5/cheetah-0.3-0.8.noarch.rpm +0 -0
  19. data/test/integration/fixtures/repositories/zoo5/create.sh +0 -20
  20. data/test/integration/fixtures/repositories/zoo5/elephant-0.3-0.8.noarch.rpm +0 -0
  21. data/test/integration/fixtures/repositories/zoo5/empty.iso +0 -0
  22. data/test/integration/fixtures/repositories/zoo5/giraffe-0.3-0.8.noarch.rpm +0 -0
  23. data/test/integration/fixtures/repositories/zoo5/images/test1.img +0 -0
  24. data/test/integration/fixtures/repositories/zoo5/images/test2.img +0 -0
  25. data/test/integration/fixtures/repositories/zoo5/lion-0.3-0.8.noarch.rpm +0 -0
  26. data/test/integration/fixtures/repositories/zoo5/monkey-0.3-0.8.noarch.rpm +0 -0
  27. data/test/integration/fixtures/repositories/zoo5/penguin-0.3-0.8.noarch.rpm +0 -0
  28. data/test/integration/fixtures/repositories/zoo5/repodata/06661e2a9839cf0beebcf409410ca4f93c09081f4e772fd0d03e1faf62705a11-comps.xml +0 -39
  29. data/test/integration/fixtures/repositories/zoo5/repodata/0c4d57a68f9a3b13dabc6f8b01ca8958aa796167cececee04717edfc26d02f2d-other.xml.gz +0 -0
  30. data/test/integration/fixtures/repositories/zoo5/repodata/298ce23f48b3613e030d19f3d9c2ff2df31c2f08479bdf94cebb87c208e48c0e-filelists.xml.gz +0 -0
  31. data/test/integration/fixtures/repositories/zoo5/repodata/32c0e38317aade0c057b173ff62344e912e1bd650409c6ac31aecee78e3413af-comps.xml.gz +0 -0
  32. data/test/integration/fixtures/repositories/zoo5/repodata/34d954906c7ce7aa2254e24d7be0a9049e0a2f436add023ca056123a2d48e30e-updateinfo.xml.gz +0 -0
  33. data/test/integration/fixtures/repositories/zoo5/repodata/63aedd074d9f0daf7c6be8c61f91d76a962bb6ceda86b9abd2140f154c320fa2-other.sqlite.bz2 +0 -0
  34. data/test/integration/fixtures/repositories/zoo5/repodata/69d65cdebffc6199d3adb3e38b06ca9abaae6c1c7366805099987b28f182178d-filelists.sqlite.bz2 +0 -0
  35. data/test/integration/fixtures/repositories/zoo5/repodata/799241a518a4a6b11a68f8e6fbdb719875f87832f60accc0851ced0d6a0497c6-updateinfo.xml.gz +0 -0
  36. data/test/integration/fixtures/repositories/zoo5/repodata/a4ea9fcdce31dc8673c7a9ba66c086bd6a16e1eff717e3896dd1cac444a1423c-primary.xml.gz +0 -0
  37. data/test/integration/fixtures/repositories/zoo5/repodata/fb9b9508e148368d0edf7e03dc905b343937fd958e6531cce6380933d18c3455-primary.sqlite.bz2 +0 -0
  38. data/test/integration/fixtures/repositories/zoo5/repodata/repomd.xml +0 -75
  39. data/test/integration/fixtures/repositories/zoo5/squirrel-0.3-0.8.noarch.rpm +0 -0
  40. data/test/integration/fixtures/repositories/zoo5/updateinfo.xml +0 -26
  41. data/test/integration/fixtures/repositories/zoo5/walrus-0.3-0.8.noarch.rpm +0 -0
  42. data/test/integration/fixtures/vcr_cassettes/extensions/pulp_repository_extensions.yml +0 -137
  43. data/test/integration/fixtures/vcr_cassettes/pulp_consumer.yml +0 -1529
  44. data/test/integration/fixtures/vcr_cassettes/pulp_consumer_group.yml +0 -430
  45. data/test/integration/fixtures/vcr_cassettes/pulp_consumer_helper.yml +0 -120
  46. data/test/integration/fixtures/vcr_cassettes/pulp_distribution.yml +0 -77
  47. data/test/integration/fixtures/vcr_cassettes/pulp_errata.yml +0 -77
  48. data/test/integration/fixtures/vcr_cassettes/pulp_filter.yml +0 -233
  49. data/test/integration/fixtures/vcr_cassettes/pulp_filter_helper.yml +0 -81
  50. data/test/integration/fixtures/vcr_cassettes/pulp_package.yml +0 -155
  51. data/test/integration/fixtures/vcr_cassettes/pulp_package_group.yml +0 -40
  52. data/test/integration/fixtures/vcr_cassettes/pulp_package_group_category.yml +0 -40
  53. data/test/integration/fixtures/vcr_cassettes/pulp_ping.yml +0 -40
  54. data/test/integration/fixtures/vcr_cassettes/pulp_repository.yml +0 -1196
  55. data/test/integration/fixtures/vcr_cassettes/pulp_repository_helper.yml +0 -8659
  56. data/test/integration/fixtures/vcr_cassettes/pulp_repository_sync.yml +0 -215
  57. data/test/integration/fixtures/vcr_cassettes/pulp_role.yml +0 -193
  58. data/test/integration/fixtures/vcr_cassettes/pulp_roles.yml +0 -120
  59. data/test/integration/fixtures/vcr_cassettes/pulp_task.yml +0 -943
  60. data/test/integration/fixtures/vcr_cassettes/pulp_user.yml +0 -664
  61. data/test/integration/fixtures/vcr_cassettes/pulp_user_helper.yml +0 -683
  62. data/test/integration/resources/helpers/consumer_helper.rb +0 -49
  63. data/test/integration/resources/helpers/filter_helper.rb +0 -44
  64. data/test/integration/resources/helpers/repository_helper.rb +0 -127
  65. data/test/integration/resources/pulp_consumer_group_test.rb +0 -182
  66. data/test/integration/resources/pulp_consumer_test.rb +0 -200
  67. data/test/integration/resources/pulp_distribution_test.rb +0 -55
  68. data/test/integration/resources/pulp_errata_test.rb +0 -60
  69. data/test/integration/resources/pulp_filter_test.rb +0 -92
  70. data/test/integration/resources/pulp_package_group_category_test.rb +0 -55
  71. data/test/integration/resources/pulp_package_group_test.rb +0 -56
  72. data/test/integration/resources/pulp_package_test.rb +0 -79
  73. data/test/integration/resources/pulp_ping_test.rb +0 -31
  74. data/test/integration/resources/pulp_repository_test.rb +0 -307
  75. data/test/integration/resources/pulp_role_test.rb +0 -62
  76. data/test/integration/resources/pulp_task_test.rb +0 -79
  77. data/test/integration/resources/pulp_user_test.rb +0 -105
  78. data/test/integration/test_runner.rb +0 -121
  79. data/test/integration/vcr_setup.rb +0 -22
  80. data/test/unit/test_base.rb +0 -62
@@ -1,62 +0,0 @@
1
- # Copyright 2012 Red Hat, Inc.
2
- #
3
- # This software is licensed to you under the GNU General Public
4
- # License as published by the Free Software Foundation; either version
5
- # 2 of the License (GPLv2) or (at your option) any later version.
6
- # There is NO WARRANTY for this software, express or implied,
7
- # including the implied warranties of MERCHANTABILITY,
8
- # NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
9
- # have received a copy of GPLv2 along with this software; if not, see
10
- # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
11
-
12
- require 'rubygems'
13
- require 'minitest/autorun'
14
-
15
- require './lib/runcible/resources/user'
16
- require './lib/runcible/resources/role'
17
-
18
-
19
- class TestPulpRoles < MiniTest::Unit::TestCase
20
- def setup
21
- @username = "integration_test_user"
22
- @role_name = "super-users"
23
- @resource = Runcible::Pulp::Role
24
-
25
- VCR.use_cassette('pulp_user') do
26
- Runcible::Pulp::User.create(@username)
27
- end
28
-
29
- VCR.insert_cassette('pulp_role')
30
- end
31
-
32
- def teardown
33
- VCR.use_cassette('pulp_user') do
34
- Runcible::Pulp::User.delete(@username)
35
- end
36
-
37
- VCR.eject_cassette
38
- end
39
-
40
- def test_path_without_role_name
41
- path = @resource.path
42
- assert_match("roles/", path)
43
- end
44
-
45
- def test_path_with_role_name
46
- path = @resource.path(@role_name)
47
- assert_match("roles/#{@role_name}", path)
48
- end
49
-
50
- def test_add
51
- response = @resource.add(@role_name, @username)
52
- assert response.code == 200
53
- @resource.remove(@role_name, @username)
54
- end
55
-
56
- def test_remove
57
- @resource.add(@role_name, @username)
58
- response = @resource.remove(@role_name, @username)
59
- assert response.code == 200
60
- end
61
-
62
- end
@@ -1,79 +0,0 @@
1
- # Copyright 2012 Red Hat, Inc.
2
- #
3
- # This software is licensed to you under the GNU General Public
4
- # License as published by the Free Software Foundation; either version
5
- # 2 of the License (GPLv2) or (at your option) any later version.
6
- # There is NO WARRANTY for this software, express or implied,
7
- # including the implied warranties of MERCHANTABILITY,
8
- # NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
9
- # have received a copy of GPLv2 along with this software; if not, see
10
- # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
11
-
12
- require 'rubygems'
13
- require 'minitest/autorun'
14
-
15
- require './test/integration/resources/helpers/repository_helper'
16
- require './lib/runcible/resources/task'
17
-
18
-
19
- module TestPulpTaskBase
20
- include RepositoryHelper
21
-
22
- def setup
23
- @resource = Runcible::Pulp::Task
24
- VCR.insert_cassette('pulp_task')
25
- end
26
-
27
- def teardown
28
- VCR.eject_cassette
29
- end
30
-
31
- end
32
-
33
-
34
- class TestPulpTask < MiniTest::Unit::TestCase
35
- include TestPulpTaskBase
36
-
37
- def setup
38
- super
39
- RepositoryHelper.create_repo(:importer => true)
40
- RepositoryHelper.sync_repo(false)
41
- end
42
-
43
- def teardown
44
- super
45
- RepositoryHelper.destroy_repo
46
- end
47
-
48
- def test_path
49
- path = @resource.path
50
- assert_match("tasks/", path)
51
- end
52
-
53
- def test_path_with_task_id
54
- path = @resource.path(RepositoryHelper.task['task_id'])
55
- assert_match("tasks/#{RepositoryHelper.task['task_id']}/", path)
56
- end
57
-
58
- def test_poll
59
- response = @resource.poll(RepositoryHelper.task['task_id'])
60
- assert response.code == 200
61
- assert response['task_id'] == RepositoryHelper.task['task_id']
62
- end
63
-
64
- def test_list
65
- response = @resource.list
66
- assert response.code == 200
67
- assert response.length > 0
68
- #assert response.first['task_id'] == RepositoryHelper.task['task_id']
69
- end
70
-
71
- =begin
72
- #TODO: Needs more reliable testable scenario - scheduled sync in the future?
73
- def test_cancel
74
- response = @resource.cancel(RepositoryHelper.task['task_id'])
75
- assert response.code == 200
76
- end
77
- =end
78
-
79
- end
@@ -1,105 +0,0 @@
1
- # Copyright 2012 Red Hat, Inc.
2
- #
3
- # This software is licensed to you under the GNU General Public
4
- # License as published by the Free Software Foundation; either version
5
- # 2 of the License (GPLv2) or (at your option) any later version.
6
- # There is NO WARRANTY for this software, express or implied,
7
- # including the implied warranties of MERCHANTABILITY,
8
- # NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
9
- # have received a copy of GPLv2 along with this software; if not, see
10
- # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
11
-
12
- require 'rubygems'
13
- require 'minitest/autorun'
14
-
15
- require './lib/runcible/resources/user'
16
-
17
-
18
- module TestPulpUserBase
19
- def setup
20
- VCR.insert_cassette('pulp_user')
21
- @username = "integration_test_user"
22
- @resource = Runcible::Pulp::User
23
- end
24
-
25
- def teardown
26
- VCR.eject_cassette
27
- end
28
- end
29
-
30
- class TestPulpUserCreate < MiniTest::Unit::TestCase
31
- include TestPulpUserBase
32
-
33
- def teardown
34
- super
35
- VCR.use_cassette('pulp_user_helper') do
36
- begin
37
- @resource.retrieve(@username)
38
- @resource.delete(@username)
39
- rescue RestClient::ResourceNotFound => e
40
- end
41
- end
42
- end
43
-
44
- def test_create
45
- response = @resource.create(@username)
46
- assert response.code == 201
47
- assert response['login'] == @username
48
- end
49
-
50
- def test_create_with_name_and_password
51
- response = @resource.create(@username, {:name => @username, :password => "integration_test_password"})
52
- assert response.code == 201
53
- assert response['name'] == @username
54
- end
55
-
56
- end
57
-
58
-
59
- class TestPulpUser < MiniTest::Unit::TestCase
60
- include TestPulpUserBase
61
-
62
- def setup
63
- super
64
- VCR.use_cassette('pulp_user_helper') do
65
- begin
66
- @resource.retrieve(@username)
67
- rescue RestClient::ResourceNotFound => e
68
- @resource.create(@username)
69
- end
70
- end
71
- end
72
-
73
- def teardown
74
- super
75
- VCR.use_cassette('pulp_user_helper') do
76
- begin
77
- @resource.retrieve(@username)
78
- @resource.delete(@username)
79
- rescue RestClient::ResourceNotFound => e
80
- end
81
- end
82
- end
83
-
84
- def test_path_without_username
85
- path = @resource.path
86
- assert_match("users/", path)
87
- end
88
-
89
- def test_path_with_username
90
- path = @resource.path(@username)
91
- assert_match("users/#{@username}", path)
92
- end
93
-
94
- def test_retrieve
95
- response = @resource.retrieve(@username)
96
- assert response.code == 200
97
- assert response["login"] == @username
98
- end
99
-
100
- def test_delete
101
- response = @resource.delete(@username)
102
- assert response.code == 200
103
- end
104
-
105
- end
@@ -1,121 +0,0 @@
1
- # Copyright 2012 Red Hat, Inc.
2
- #
3
- # This software is licensed to you under the GNU General Public
4
- # License as published by the Free Software Foundation; either version
5
- # 2 of the License (GPLv2) or (at your option) any later version.
6
- # There is NO WARRANTY for this software, express or implied,
7
- # including the implied warranties of MERCHANTABILITY,
8
- # NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
9
- # have received a copy of GPLv2 along with this software; if not, see
10
- # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
11
-
12
- require 'rubygems'
13
- require 'minitest/unit'
14
- require 'minitest/autorun'
15
-
16
- require 'test/integration/vcr_setup'
17
- require './lib/runcible/base'
18
-
19
-
20
- class CustomMiniTestRunner
21
- class Unit < MiniTest::Unit
22
-
23
- def before_suites
24
- # code to run before the first test
25
- end
26
-
27
- def after_suites
28
- # code to run after the last test
29
- end
30
-
31
- def _run_suites(suites, type)
32
- begin
33
- before_suites
34
- super(suites, type)
35
- ensure
36
- after_suites
37
- end
38
- end
39
-
40
- def _run_suite(suite, type)
41
- begin
42
- suite.before_suite if suite.respond_to?(:before_suite)
43
- super(suite, type)
44
- ensure
45
- suite.after_suite if suite.respond_to?(:after_suite)
46
- end
47
- end
48
-
49
- end
50
- end
51
-
52
-
53
- class PulpMiniTestRunner
54
-
55
- def run_tests(options={})
56
- mode = options[:mode] || "recorded"
57
- test_name = options[:test_name] || nil
58
- auth_type = options[:auth_type] || "http"
59
-
60
- MiniTest::Unit.runner = CustomMiniTestRunner::Unit.new
61
-
62
- set_runcible_config(auth_type)
63
- set_vcr_config(mode)
64
-
65
- if test_name
66
- require test_name
67
- else
68
- Dir["test/integration/resources/*_test.rb"].each {|file| require file }
69
- Dir["test/integration/extensions/*_test.rb"].each {|file| require file }
70
- end
71
- end
72
-
73
- def set_runcible_config(auth_type)
74
- if auth_type == "http"
75
- Runcible::Base.config = {
76
- :api_path => "/pulp/api/v2/",
77
- :http_auth => {},
78
- :logger => 'stdout'
79
- }
80
-
81
- File.open('/etc/pulp/server.conf') do |f|
82
- f.each_line do |line|
83
- if line.start_with?('default_password')
84
- Runcible::Base.config[:http_auth][:password] = line.split(':')[1].strip
85
- elsif line.start_with?('default_login')
86
- Runcible::Base.config[:user] = line.split(':')[1].strip
87
- elsif line.start_with?('server_name')
88
- Runcible::Base.config[:url] = "https://#{line.split(':')[1].chomp.strip}"
89
- end
90
- end
91
- end
92
- elsif auth_type == "oauth"
93
- Runcible::Base.config = {
94
- :api_path => "/pulp/api/v2/",
95
- :oauth => {}
96
- }
97
-
98
- File.open('/etc/pulp/server.conf') do |f|
99
- f.each_line do |line|
100
- if line.start_with?('oauth_secret')
101
- Runcible::Base.config[:oauth][:oauth_secret] = line.split(':')[1].strip
102
- elsif line.start_with?('oauth_key')
103
- Runcible::Base.config[:oauth][:oauth_key] = line.split(':')[1].strip
104
- elsif line.start_with?('default_login')
105
- Runcible::Base.config[:user] = line.split(':')[1].strip
106
- elsif line.start_with?('server_name')
107
- Runcible::Base.config[:url] = "https://#{line.split(':')[1].chomp.strip}"
108
- end
109
- end
110
- end
111
- end
112
- end
113
-
114
- def set_vcr_config(mode)
115
- if mode == "live"
116
- configure_vcr(:all)
117
- else
118
- configure_vcr(:new_episodes)
119
- end
120
- end
121
- end
@@ -1,22 +0,0 @@
1
- # Copyright 2012 Red Hat, Inc.
2
- #
3
- # This software is licensed to you under the GNU General Public
4
- # License as published by the Free Software Foundation; either version
5
- # 2 of the License (GPLv2) or (at your option) any later version.
6
- # There is NO WARRANTY for this software, express or implied,
7
- # including the implied warranties of MERCHANTABILITY,
8
- # NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
9
- # have received a copy of GPLv2 along with this software; if not, see
10
- # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
11
-
12
- require 'rubygems'
13
- require 'vcr'
14
-
15
-
16
- def configure_vcr(record_mode=:all)
17
- VCR.configure do |c|
18
- c.cassette_library_dir = 'test/integration/fixtures/vcr_cassettes'
19
- c.hook_into :webmock
20
- c.default_cassette_options = { :record => record_mode } #forcing all requests to Pulp currently
21
- end
22
- end
@@ -1,62 +0,0 @@
1
- # Copyright (c) 2012 Eric D Helms
2
- #
3
- # MIT License
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining
6
- # a copy of this software and associated documentation files (the
7
- # "Software"), to deal in the Software without restriction, including
8
- # without limitation the rights to use, copy, modify, merge, publish,
9
- # distribute, sublicense, and/or sell copies of the Software, and to
10
- # permit persons to whom the Software is furnished to do so, subject to
11
- # the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be
14
- # included in all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
-
24
- require 'rubygems'
25
- require 'minitest/autorun'
26
- require 'minitest/mock'
27
- require 'ruby-debug'
28
- require './lib/runcible/base'
29
-
30
-
31
- class TestBase < MiniTest::Unit::TestCase
32
- def setup
33
- Runcible::Base.config = {
34
- :base_url => "http://localhost/",
35
- :user => "test_user",
36
- :password => "test_password",
37
- :oauth => "test_oauth",
38
- :headers => { :content_type => 'application/json',
39
- :accept => 'application/json' }
40
- }
41
-
42
- @base = Runcible::Base.new
43
- end
44
-
45
- def test_config
46
- assert !Runcible::Base.config.nil?
47
- end
48
-
49
- def test_process_response_returns_hash
50
- json = { :a => "test", :b => "data" }.to_json
51
- data = @base.process_response(json)
52
-
53
- assert data["a"] = "test"
54
- end
55
-
56
- def test_process_response_returns_string
57
- string = "true"
58
- data = @base.process_response(string)
59
-
60
- assert data = "true"
61
- end
62
- end