pulp 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +19 -0
- data/Gemfile.lock +42 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +147 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/examples/repositories.rb +205 -0
- data/examples/test_pulp.yml +4 -0
- data/lib/pulp.rb +26 -0
- data/lib/pulp/cds.rb +25 -0
- data/lib/pulp/common/debug.rb +37 -0
- data/lib/pulp/common/lifecycle.rb +166 -0
- data/lib/pulp/common/lifecycle/create.rb +16 -0
- data/lib/pulp/common/lifecycle/delete.rb +23 -0
- data/lib/pulp/common/lifecycle/get.rb +22 -0
- data/lib/pulp/common/lifecycle/update.rb +23 -0
- data/lib/pulp/connection/base.rb +84 -0
- data/lib/pulp/connection/handler.rb +59 -0
- data/lib/pulp/consumer.rb +23 -0
- data/lib/pulp/consumergroup.rb +22 -0
- data/lib/pulp/content.rb +14 -0
- data/lib/pulp/distribution.rb +11 -0
- data/lib/pulp/errata.rb +17 -0
- data/lib/pulp/event.rb +8 -0
- data/lib/pulp/filter.rb +19 -0
- data/lib/pulp/package.rb +20 -0
- data/lib/pulp/package_group.rb +8 -0
- data/lib/pulp/package_group_category.rb +7 -0
- data/lib/pulp/repository.rb +114 -0
- data/lib/pulp/service.rb +51 -0
- data/lib/pulp/task.rb +37 -0
- data/lib/pulp/task_history.rb +10 -0
- data/lib/pulp/task_snapshot.rb +9 -0
- data/lib/pulp/user.rb +12 -0
- data/spec/pulp/common/debug_spec.rb +42 -0
- data/spec/pulp/common/lifecycle/create_spec.rb +21 -0
- data/spec/pulp/common/lifecycle/delete_spec.rb +40 -0
- data/spec/pulp/common/lifecycle/get_spec.rb +42 -0
- data/spec/pulp/common/lifecycle/update_spec.rb +48 -0
- data/spec/pulp/common/lifecycle_spec.rb +393 -0
- data/spec/pulp/connection/base_spec.rb +312 -0
- data/spec/pulp/connection/handler_spec.rb +123 -0
- data/spec/pulp/content_spec.rb +21 -0
- data/spec/pulp/package_spec.rb +14 -0
- data/spec/pulp/repository_spec.rb +14 -0
- data/spec/pulp/service_spec.rb +85 -0
- data/spec/pulp/task_spec.rb +48 -0
- data/spec/pulp_spec.rb +4 -0
- data/spec/spec.opts +6 -0
- data/spec/spec_helper.rb +32 -0
- metadata +252 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
3
|
+
|
4
|
+
describe Pulp::Package do
|
5
|
+
|
6
|
+
|
7
|
+
describe ".by_nvrea" do
|
8
|
+
it "should get the package via NVREA" do
|
9
|
+
Pulp::Package.expects(:base_get).with('n/v/r/e/a',nil,nil).returns('name' => 'package1')
|
10
|
+
Pulp::Package.by_nvrea('n','v','r','e','a').name.should eql('package1')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
3
|
+
|
4
|
+
describe Pulp::Repository do
|
5
|
+
|
6
|
+
|
7
|
+
describe ".schedules" do
|
8
|
+
it "should get all schedules" do
|
9
|
+
Pulp::Repository.expects(:base_get).with('schedules/',nil,nil).returns(1)
|
10
|
+
Pulp::Repository.schedules.should eql(1)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
3
|
+
|
4
|
+
describe Pulp::Service do
|
5
|
+
|
6
|
+
|
7
|
+
describe ".dependencies" do
|
8
|
+
it "return a list of dependencies" do
|
9
|
+
Pulp::Service.expects(:base_post).with('','dependencies/',{:pkgnames => [1], :repoids => [2]}).returns(1)
|
10
|
+
Pulp::Service.dependencies([1],[2]).should eql(1)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe ".search_package" do
|
15
|
+
it "should search package" do
|
16
|
+
Pulp::Service.expects(:base_post).with('','search/packages/',{:name => 'foo'}).returns(1)
|
17
|
+
Pulp::Service.search_package(:name => 'foo').should eql(1)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe ".start_upload" do
|
22
|
+
context "without an id" do
|
23
|
+
it "should start a file upload" do
|
24
|
+
Pulp::Service.expects(:base_post).with('','upload',{:name => 'foo',:size => 2, :checksum => 'aa'}).returns(1)
|
25
|
+
Pulp::Service.start_upload('foo',2,'aa').should eql(1)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "with an id" do
|
30
|
+
it "should start a file upload with the id" do
|
31
|
+
Pulp::Service.expects(:base_post).with('','upload',{:name => 'foo',:size => 2, :checksum => 'aa', :id => 1}).returns(1)
|
32
|
+
Pulp::Service.start_upload('foo',2,'aa',1).should eql(1)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe ".append_file_content" do
|
38
|
+
it "should append file content to the specific id" do
|
39
|
+
Pulp::Service.expects(:base_post).with('','upload/1/append',"content").returns(1)
|
40
|
+
Pulp::Service.append_file_content(1,'content').should eql(1)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe ".import_file" do
|
45
|
+
it "should import an uploaded file" do
|
46
|
+
Pulp::Service.expects(:base_put).with('','upload/import',{:uploadid => 1, :metadata => {:a => 1}}).returns(1)
|
47
|
+
Pulp::Service.import_file(1,:a => 1).should eql(1)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe ".package_checksum" do
|
52
|
+
it "lookup package checksums" do
|
53
|
+
Pulp::Service.expects(:base_put).with('','packages/checksum/',['package1','package2']).returns(1)
|
54
|
+
Pulp::Service.package_checksum(['package1','package2']).should eql(1)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
describe ".file_checksum" do
|
58
|
+
it "lookup file checksums" do
|
59
|
+
Pulp::Service.expects(:base_put).with('','files/checksum/',['file1','file2']).returns(1)
|
60
|
+
Pulp::Service.file_checksum(['file1','file2']).should eql(1)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe ".associate_package" do
|
65
|
+
it "should associate a list of packages with repos" do
|
66
|
+
Pulp::Service.expects(:base_post).with('','associate/packages/',[[['file1','checksum1'],['repo1']],[['file2','checksum2'],['repo2','repo3']]]).returns(1)
|
67
|
+
Pulp::Service.associate_packages([[['file1','checksum1'],['repo1']],[['file2','checksum2'],['repo2','repo3']]]).should eql(1)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe ".repo_discovery" do
|
72
|
+
it "should create a task to discover a repositories at a given url" do
|
73
|
+
Pulp::Service.expects(:base_post).with('','discovery/repo/',{:url => 'url1',:type => 'yum',:cert_data => {:ca => 'ca', :cert => 'cert'}}).returns('id' => 2)
|
74
|
+
Pulp::Service.repo_discovery('url1','yum',{:ca => 'ca', :cert => 'cert'}).id.should eql(2)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe ".repo_discovery_staus" do
|
79
|
+
it "should give me a result of discovered repos" do
|
80
|
+
Pulp::Service.expects(:base_get).with('','discovery/repo/2',nil).returns('id' => 2, 'result' => 'foo')
|
81
|
+
Pulp::Service.repo_discovery_staus(2).result.should eql('foo')
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
3
|
+
|
4
|
+
describe Pulp::Task do
|
5
|
+
|
6
|
+
describe ".cancel" do
|
7
|
+
it "should cancel the task" do
|
8
|
+
Pulp::Task.expects(:base_post).with(1,'cancel/',nil).returns('id' => 2)
|
9
|
+
Pulp::Task.cancel(1).id.should eql(2)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#cancel" do
|
14
|
+
it "should cancel the task" do
|
15
|
+
Pulp::Task.expects(:base_post).with(1,'cancel/',nil).returns('id' => 2)
|
16
|
+
Pulp::Task.new('id' => 1).cancel.id.should eql(2)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe ".delete_snapshot" do
|
21
|
+
it "should delete the snapshot" do
|
22
|
+
Pulp::Task.expects(:base_delete).with(1,'snapshot/',nil).returns('id' => 2)
|
23
|
+
Pulp::Task.delete_snapshot(1).id.should eql(2)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#delete_snapshot" do
|
28
|
+
it "should delete the snapshot" do
|
29
|
+
Pulp::Task.expects(:base_delete).with(1,'snapshot/',nil).returns('id' => 2)
|
30
|
+
Pulp::Task.new('id' => 1).delete_snapshot.id.should eql(2)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe ".snapshot" do
|
35
|
+
it "get a snapshot of the task" do
|
36
|
+
Pulp::Task.expects(:base_get).with(1,'snapshot/',nil).returns('id' => 2)
|
37
|
+
Pulp::Task.snapshot(1).id.should eql(2)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "#snapshot" do
|
42
|
+
it "should get the snapshot" do
|
43
|
+
Pulp::Task.expects(:base_get).with(1,'snapshot/',nil).returns('id' => 2)
|
44
|
+
Pulp::Task.new('id' => 1).snapshot.id.should eql(2)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
data/spec/pulp_spec.rb
ADDED
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'pulp'
|
5
|
+
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.mock_with :mocha
|
12
|
+
end
|
13
|
+
|
14
|
+
class DummyResult
|
15
|
+
def self.body
|
16
|
+
JSON.dump(real_body)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.real_body
|
20
|
+
{ 'a' => 1 }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class UnparsedDummyResult
|
25
|
+
def self.body
|
26
|
+
"True"
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.real_body
|
30
|
+
body
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,252 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pulp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 15
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 8
|
10
|
+
version: 0.0.8
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- mh
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-01-05 00:00:00 +01:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
type: :runtime
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 1
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 6
|
32
|
+
- 7
|
33
|
+
version: 1.6.7
|
34
|
+
version_requirements: *id001
|
35
|
+
name: rest-client
|
36
|
+
prerelease: false
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
type: :runtime
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
48
|
+
version_requirements: *id002
|
49
|
+
name: activesupport
|
50
|
+
prerelease: false
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
type: :runtime
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
version_requirements: *id003
|
63
|
+
name: json
|
64
|
+
prerelease: false
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
type: :runtime
|
67
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
version: "0"
|
76
|
+
version_requirements: *id004
|
77
|
+
name: i18n
|
78
|
+
prerelease: false
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
type: :development
|
81
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ~>
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
hash: 3
|
87
|
+
segments:
|
88
|
+
- 2
|
89
|
+
- 3
|
90
|
+
- 0
|
91
|
+
version: 2.3.0
|
92
|
+
version_requirements: *id005
|
93
|
+
name: rspec
|
94
|
+
prerelease: false
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
type: :development
|
97
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ~>
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
hash: 23
|
103
|
+
segments:
|
104
|
+
- 1
|
105
|
+
- 0
|
106
|
+
- 0
|
107
|
+
version: 1.0.0
|
108
|
+
version_requirements: *id006
|
109
|
+
name: bundler
|
110
|
+
prerelease: false
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
type: :development
|
113
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ~>
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
hash: 7
|
119
|
+
segments:
|
120
|
+
- 1
|
121
|
+
- 6
|
122
|
+
- 4
|
123
|
+
version: 1.6.4
|
124
|
+
version_requirements: *id007
|
125
|
+
name: jeweler
|
126
|
+
prerelease: false
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
type: :development
|
129
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
hash: 3
|
135
|
+
segments:
|
136
|
+
- 0
|
137
|
+
version: "0"
|
138
|
+
version_requirements: *id008
|
139
|
+
name: rcov
|
140
|
+
prerelease: false
|
141
|
+
- !ruby/object:Gem::Dependency
|
142
|
+
type: :development
|
143
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
144
|
+
none: false
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
hash: 3
|
149
|
+
segments:
|
150
|
+
- 0
|
151
|
+
version: "0"
|
152
|
+
version_requirements: *id009
|
153
|
+
name: mocha
|
154
|
+
prerelease: false
|
155
|
+
description: A little ruby wrapper around th pulp (http://pulpproject.org) API
|
156
|
+
email: mh@immerda.ch
|
157
|
+
executables: []
|
158
|
+
|
159
|
+
extensions: []
|
160
|
+
|
161
|
+
extra_rdoc_files:
|
162
|
+
- LICENSE.txt
|
163
|
+
- README.rdoc
|
164
|
+
files:
|
165
|
+
- .document
|
166
|
+
- .rspec
|
167
|
+
- Gemfile
|
168
|
+
- Gemfile.lock
|
169
|
+
- LICENSE.txt
|
170
|
+
- README.rdoc
|
171
|
+
- Rakefile
|
172
|
+
- VERSION
|
173
|
+
- examples/repositories.rb
|
174
|
+
- examples/test_pulp.yml
|
175
|
+
- lib/pulp.rb
|
176
|
+
- lib/pulp/cds.rb
|
177
|
+
- lib/pulp/common/debug.rb
|
178
|
+
- lib/pulp/common/lifecycle.rb
|
179
|
+
- lib/pulp/common/lifecycle/create.rb
|
180
|
+
- lib/pulp/common/lifecycle/delete.rb
|
181
|
+
- lib/pulp/common/lifecycle/get.rb
|
182
|
+
- lib/pulp/common/lifecycle/update.rb
|
183
|
+
- lib/pulp/connection/base.rb
|
184
|
+
- lib/pulp/connection/handler.rb
|
185
|
+
- lib/pulp/consumer.rb
|
186
|
+
- lib/pulp/consumergroup.rb
|
187
|
+
- lib/pulp/content.rb
|
188
|
+
- lib/pulp/distribution.rb
|
189
|
+
- lib/pulp/errata.rb
|
190
|
+
- lib/pulp/event.rb
|
191
|
+
- lib/pulp/filter.rb
|
192
|
+
- lib/pulp/package.rb
|
193
|
+
- lib/pulp/package_group.rb
|
194
|
+
- lib/pulp/package_group_category.rb
|
195
|
+
- lib/pulp/repository.rb
|
196
|
+
- lib/pulp/service.rb
|
197
|
+
- lib/pulp/task.rb
|
198
|
+
- lib/pulp/task_history.rb
|
199
|
+
- lib/pulp/task_snapshot.rb
|
200
|
+
- lib/pulp/user.rb
|
201
|
+
- spec/pulp/common/debug_spec.rb
|
202
|
+
- spec/pulp/common/lifecycle/create_spec.rb
|
203
|
+
- spec/pulp/common/lifecycle/delete_spec.rb
|
204
|
+
- spec/pulp/common/lifecycle/get_spec.rb
|
205
|
+
- spec/pulp/common/lifecycle/update_spec.rb
|
206
|
+
- spec/pulp/common/lifecycle_spec.rb
|
207
|
+
- spec/pulp/connection/base_spec.rb
|
208
|
+
- spec/pulp/connection/handler_spec.rb
|
209
|
+
- spec/pulp/content_spec.rb
|
210
|
+
- spec/pulp/package_spec.rb
|
211
|
+
- spec/pulp/repository_spec.rb
|
212
|
+
- spec/pulp/service_spec.rb
|
213
|
+
- spec/pulp/task_spec.rb
|
214
|
+
- spec/pulp_spec.rb
|
215
|
+
- spec/spec.opts
|
216
|
+
- spec/spec_helper.rb
|
217
|
+
has_rdoc: true
|
218
|
+
homepage: https://github.com/duritong
|
219
|
+
licenses:
|
220
|
+
- MIT
|
221
|
+
post_install_message:
|
222
|
+
rdoc_options: []
|
223
|
+
|
224
|
+
require_paths:
|
225
|
+
- lib
|
226
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
227
|
+
none: false
|
228
|
+
requirements:
|
229
|
+
- - ">="
|
230
|
+
- !ruby/object:Gem::Version
|
231
|
+
hash: 3
|
232
|
+
segments:
|
233
|
+
- 0
|
234
|
+
version: "0"
|
235
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
236
|
+
none: false
|
237
|
+
requirements:
|
238
|
+
- - ">="
|
239
|
+
- !ruby/object:Gem::Version
|
240
|
+
hash: 3
|
241
|
+
segments:
|
242
|
+
- 0
|
243
|
+
version: "0"
|
244
|
+
requirements: []
|
245
|
+
|
246
|
+
rubyforge_project:
|
247
|
+
rubygems_version: 1.6.2
|
248
|
+
signing_key:
|
249
|
+
specification_version: 3
|
250
|
+
summary: A little ruby wrapper around th pulp API
|
251
|
+
test_files: []
|
252
|
+
|