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,312 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
3
|
+
|
4
|
+
module Pulp
|
5
|
+
class Test < Pulp::Connection::Base
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
module Pulp
|
10
|
+
class Test2 < Pulp::Connection::Base
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe Pulp::Connection::Base do
|
15
|
+
describe ".reset" do
|
16
|
+
it "resets the used base" do
|
17
|
+
a = Pulp::Test.send(:base)
|
18
|
+
Pulp::Test.reset
|
19
|
+
a.should_not eql(Pulp::Test.send(:base))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe ".identifier" do
|
24
|
+
it "is the downcased class name" do
|
25
|
+
Pulp::Test.identifier.should eql('test')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe ".base" do
|
30
|
+
it "differs based on the used class" do
|
31
|
+
Pulp::Test.base.should_not eql(Pulp::Test2.send(:base))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe ".plain_base" do
|
36
|
+
it "is without any context" do
|
37
|
+
Pulp::Test.plain_base.url.should eql('https://localhost/pulp/api/')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe ".parse_item_cmd" do
|
42
|
+
context "with an item" do
|
43
|
+
it "should prefix with an item" do
|
44
|
+
Pulp::Test.parse_item_cmd('foo','bla').should eql('/foo/bla')
|
45
|
+
end
|
46
|
+
it "should not double prefix the cmd" do
|
47
|
+
Pulp::Test.parse_item_cmd('foo','/bla').should eql('/foo/bla')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
context "without an item" do
|
51
|
+
it "should prefix the cmd with a slash" do
|
52
|
+
Pulp::Test.parse_item_cmd(nil,'bla').should eql('/bla')
|
53
|
+
end
|
54
|
+
it "should not double prefix the cmd" do
|
55
|
+
Pulp::Test.parse_item_cmd(nil,'/bla').should eql('/bla')
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe ".merge_params" do
|
61
|
+
it "should return an empty hash on no params" do
|
62
|
+
Pulp::Test.merge_params(nil).should eql({})
|
63
|
+
end
|
64
|
+
it "should add the params" do
|
65
|
+
Pulp::Test.merge_params({:b => 2}).should eql({ :params => {:b => 2}})
|
66
|
+
end
|
67
|
+
end
|
68
|
+
describe "base actions" do
|
69
|
+
before(:each) do
|
70
|
+
@context = Object.new
|
71
|
+
end
|
72
|
+
describe ".plain_get" do
|
73
|
+
before(:each) do
|
74
|
+
Pulp::Test.plain_base.connection.expects(:[]).with('foo').returns(@context)
|
75
|
+
end
|
76
|
+
context "without params" do
|
77
|
+
before(:each) do
|
78
|
+
@context.expects(:get).with({}).returns(DummyResult)
|
79
|
+
end
|
80
|
+
it "should return a parsed get" do
|
81
|
+
Pulp::Test.plain_get('foo').should eql(DummyResult.real_body)
|
82
|
+
end
|
83
|
+
it "should strip the api url prefix" do
|
84
|
+
Pulp::Test.plain_get('/pulp/api/foo').should eql(DummyResult.real_body)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
context "with params" do
|
88
|
+
before(:each) do
|
89
|
+
@context.expects(:get).with(:params => { :b => 2}).returns(DummyResult)
|
90
|
+
end
|
91
|
+
it "should add the params" do
|
92
|
+
Pulp::Test.plain_get('/pulp/api/foo',:b => 2).should eql(DummyResult.real_body)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
context "parsed" do
|
97
|
+
[:get, :delete ].each do |method|
|
98
|
+
describe ".base_#{method}" do
|
99
|
+
context "with an item" do
|
100
|
+
before(:each) do
|
101
|
+
Pulp::Test.base.connection.expects(:[]).with('/blub/foo').returns(@context)
|
102
|
+
end
|
103
|
+
context "without params" do
|
104
|
+
before(:each) do
|
105
|
+
@context.expects(method).with({}).returns(DummyResult)
|
106
|
+
end
|
107
|
+
it "should return a parsed #{method}" do
|
108
|
+
Pulp::Test.send(:"base_#{method}",'foo','blub').should eql(DummyResult.real_body)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
context "with a params" do
|
112
|
+
before(:each) do
|
113
|
+
@context.expects(method).with({ :params => {:b => 2 }}).returns(DummyResult)
|
114
|
+
end
|
115
|
+
it "should return a parsed #{method}" do
|
116
|
+
Pulp::Test.send(:"base_#{method}",'foo','blub',:b => 2).should eql(DummyResult.real_body)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
context "without an item" do
|
121
|
+
before(:each) do
|
122
|
+
Pulp::Test.base.connection.expects(:[]).with('/foo').returns(@context)
|
123
|
+
end
|
124
|
+
context "without params" do
|
125
|
+
before(:each) do
|
126
|
+
@context.expects(method).with({}).returns(DummyResult)
|
127
|
+
end
|
128
|
+
it "should return a parsed #{method}" do
|
129
|
+
Pulp::Test.send(:"base_#{method}",'foo').should eql(DummyResult.real_body)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
context "with params" do
|
133
|
+
before(:each) do
|
134
|
+
@context.expects(method).with({:params => {:b => 2 }}).returns(DummyResult)
|
135
|
+
end
|
136
|
+
it "should return a parsed #{method}" do
|
137
|
+
Pulp::Test.send(:"base_#{method}",'foo',nil,:b => 2).should eql(DummyResult.real_body)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
[:post,:put].each do |method|
|
144
|
+
describe ".base_#{method}" do
|
145
|
+
context "with an item" do
|
146
|
+
before(:each) do
|
147
|
+
Pulp::Test.base.connection.expects(:[]).with('/blub/foo').returns(@context)
|
148
|
+
end
|
149
|
+
context "without params" do
|
150
|
+
before(:each) do
|
151
|
+
@context.expects(method).with(nil,{:content_type => :json}).returns(DummyResult)
|
152
|
+
end
|
153
|
+
it "should return a parsed #{method}" do
|
154
|
+
Pulp::Test.send(:"base_#{method}",'foo','blub').should eql(DummyResult.real_body)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
context "with a params" do
|
158
|
+
before(:each) do
|
159
|
+
@context.expects(method).with({:b => 2 }.to_json,{:content_type => :json}).returns(DummyResult)
|
160
|
+
end
|
161
|
+
it "should return a parsed #{method}" do
|
162
|
+
Pulp::Test.send(:"base_#{method}",'foo','blub',:b => 2).should eql(DummyResult.real_body)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
context "without an item" do
|
167
|
+
before(:each) do
|
168
|
+
Pulp::Test.base.connection.expects(:[]).with('/foo').returns(@context)
|
169
|
+
end
|
170
|
+
context "without params" do
|
171
|
+
before(:each) do
|
172
|
+
@context.expects(method).with(nil,{:content_type => :json}).returns(DummyResult)
|
173
|
+
end
|
174
|
+
it "should return a parsed #{method}" do
|
175
|
+
Pulp::Test.send(:"base_#{method}",'foo').should eql(DummyResult.real_body)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
context "with params" do
|
179
|
+
before(:each) do
|
180
|
+
@context.expects(method).with({:b => 2 }.to_json, {:content_type => :json}).returns(DummyResult)
|
181
|
+
end
|
182
|
+
it "should return a parsed #{method}" do
|
183
|
+
Pulp::Test.send(:"base_#{method}",'foo',nil,:b => 2).should eql(DummyResult.real_body)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
context "unparsed" do
|
191
|
+
[:get, :delete ].each do |method|
|
192
|
+
describe ".base_unparsed_#{method}" do
|
193
|
+
context "with an item" do
|
194
|
+
before(:each) do
|
195
|
+
Pulp::Test.base.connection.expects(:[]).with('/blub/foo').returns(@context)
|
196
|
+
end
|
197
|
+
context "without params" do
|
198
|
+
before(:each) do
|
199
|
+
@context.expects(method).with({}).returns(UnparsedDummyResult)
|
200
|
+
end
|
201
|
+
it "should return an unparsed #{method}" do
|
202
|
+
Pulp::Test.send(:"base_unparsed_#{method}",'foo','blub').should eql(UnparsedDummyResult.real_body)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
context "with a params" do
|
206
|
+
before(:each) do
|
207
|
+
@context.expects(method).with({ :params => {:b => 2 }}).returns(UnparsedDummyResult)
|
208
|
+
end
|
209
|
+
it "should return an unparsed #{method}" do
|
210
|
+
Pulp::Test.send(:"base_unparsed_#{method}",'foo','blub',:b => 2).should eql(UnparsedDummyResult.real_body)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
context "without an item" do
|
215
|
+
before(:each) do
|
216
|
+
Pulp::Test.base.connection.expects(:[]).with('/foo').returns(@context)
|
217
|
+
end
|
218
|
+
context "without params" do
|
219
|
+
before(:each) do
|
220
|
+
@context.expects(method).with({}).returns(UnparsedDummyResult)
|
221
|
+
end
|
222
|
+
it "should return an unparsed #{method}" do
|
223
|
+
Pulp::Test.send(:"base_unparsed_#{method}",'foo').should eql(UnparsedDummyResult.real_body)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
context "with params" do
|
227
|
+
before(:each) do
|
228
|
+
@context.expects(method).with({:params => {:b => 2 }}).returns(UnparsedDummyResult)
|
229
|
+
end
|
230
|
+
it "should return an unparsed #{method}" do
|
231
|
+
Pulp::Test.send(:"base_unparsed_#{method}",'foo',nil,:b => 2).should eql(UnparsedDummyResult.real_body)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
237
|
+
[:post,:put].each do |method|
|
238
|
+
describe ".base_#{method}" do
|
239
|
+
context "with an item" do
|
240
|
+
before(:each) do
|
241
|
+
Pulp::Test.base.connection.expects(:[]).with('/blub/foo').returns(@context)
|
242
|
+
end
|
243
|
+
context "without params" do
|
244
|
+
before(:each) do
|
245
|
+
@context.expects(method).with(nil,{:content_type => :json}).returns(UnparsedDummyResult)
|
246
|
+
end
|
247
|
+
it "should return an unparsed #{method}" do
|
248
|
+
Pulp::Test.send(:"base_unparsed_#{method}",'foo','blub').should eql(UnparsedDummyResult.real_body)
|
249
|
+
end
|
250
|
+
end
|
251
|
+
context "with a params" do
|
252
|
+
before(:each) do
|
253
|
+
@context.expects(method).with({:b => 2 }.to_json,{:content_type => :json}).returns(UnparsedDummyResult)
|
254
|
+
end
|
255
|
+
it "should return a unparsed #{method}" do
|
256
|
+
Pulp::Test.send(:"base_unparsed_#{method}",'foo','blub',:b => 2).should eql(UnparsedDummyResult.real_body)
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
context "without an item" do
|
261
|
+
before(:each) do
|
262
|
+
Pulp::Test.base.connection.expects(:[]).with('/foo').returns(@context)
|
263
|
+
end
|
264
|
+
context "without params" do
|
265
|
+
before(:each) do
|
266
|
+
@context.expects(method).with(nil,{:content_type => :json}).returns(UnparsedDummyResult)
|
267
|
+
end
|
268
|
+
it "should return an unparsed #{method}" do
|
269
|
+
Pulp::Test.send(:"base_unparsed_#{method}",'foo').should eql(UnparsedDummyResult.real_body)
|
270
|
+
end
|
271
|
+
end
|
272
|
+
context "with params" do
|
273
|
+
before(:each) do
|
274
|
+
@context.expects(method).with({:b => 2 }.to_json, {:content_type => :json}).returns(UnparsedDummyResult)
|
275
|
+
end
|
276
|
+
it "should return an unparsed #{method}" do
|
277
|
+
Pulp::Test.send(:"base_unparsed_#{method}",'foo',nil,:b => 2).should eql(UnparsedDummyResult.real_body)
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
282
|
+
end
|
283
|
+
end
|
284
|
+
end
|
285
|
+
[:hostname,:username, :password].each do |field|
|
286
|
+
describe ".#{field}" do
|
287
|
+
it "provides a way to set and read a #{field}" do
|
288
|
+
Pulp::Test.should respond_to("#{field}=")
|
289
|
+
Pulp::Test.should respond_to("#{field}")
|
290
|
+
end
|
291
|
+
|
292
|
+
it "is used for the base connection" do
|
293
|
+
Pulp::Test.reset
|
294
|
+
Pulp::Test.send("#{field}=","foo")
|
295
|
+
Pulp::Test.send(:base).instance_variable_get("@#{field}").should eql("foo")
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|
299
|
+
describe "default special fields" do
|
300
|
+
[:id, :_id].each do |field|
|
301
|
+
it "#{field} is a special_field" do
|
302
|
+
Pulp::Connection::Base.special_fields.should include(field)
|
303
|
+
end
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
describe "initialization" do
|
308
|
+
it "initializes the fields with the supplied data" do
|
309
|
+
Pulp::Test.new(:a => 1).fields[:a].should eql(1)
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
3
|
+
|
4
|
+
describe Pulp::Connection::Handler do
|
5
|
+
|
6
|
+
[:hostname,:username, :password].each do |field|
|
7
|
+
it "provides a way to set and read a default #{field}" do
|
8
|
+
Pulp::Connection::Handler.should respond_to("#{field}=")
|
9
|
+
Pulp::Connection::Handler.should respond_to("#{field}")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe ".instance_for" do
|
14
|
+
it "returns an instance of Pulp::Connection::Handler" do
|
15
|
+
Pulp::Connection::Handler.instance_for(:foo).should be_a(Pulp::Connection::Handler)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "caches the instances" do
|
19
|
+
Pulp::Connection::Handler.instance_for(:foo).should eql(Pulp::Connection::Handler.instance_for(:foo))
|
20
|
+
end
|
21
|
+
|
22
|
+
it "takes default hostname if no argument is passed" do
|
23
|
+
Pulp::Connection::Handler.hostname = 'blub'
|
24
|
+
Pulp::Connection::Handler.instance_for(:default_hostname).instance_variable_get('@hostname').should eql('blub')
|
25
|
+
end
|
26
|
+
it "takes passed hostname" do
|
27
|
+
Pulp::Connection::Handler.hostname = 'blub'
|
28
|
+
Pulp::Connection::Handler.instance_for(:default_hostname2,'bla').instance_variable_get('@hostname').should eql('bla')
|
29
|
+
end
|
30
|
+
|
31
|
+
it "takes default username if no argument is passed" do
|
32
|
+
Pulp::Connection::Handler.username = 'user'
|
33
|
+
Pulp::Connection::Handler.instance_for(:default_user,'bla').instance_variable_get('@username').should eql('user')
|
34
|
+
end
|
35
|
+
it "takes passed username" do
|
36
|
+
Pulp::Connection::Handler.username = 'user'
|
37
|
+
Pulp::Connection::Handler.instance_for(:default_user2,'bla','user2').instance_variable_get('@username').should eql('user2')
|
38
|
+
end
|
39
|
+
|
40
|
+
it "takes default password if no argument is passed" do
|
41
|
+
Pulp::Connection::Handler.password = 'secret'
|
42
|
+
Pulp::Connection::Handler.instance_for(:default_pwd,'bla','user').instance_variable_get('@password').should eql('secret')
|
43
|
+
end
|
44
|
+
it "takes passed password" do
|
45
|
+
Pulp::Connection::Handler.password = 'secret'
|
46
|
+
Pulp::Connection::Handler.instance_for(:default_pwd2,'bla','user2','secret2').instance_variable_get('@password').should eql('secret2')
|
47
|
+
end
|
48
|
+
|
49
|
+
it "defaults https to true" do
|
50
|
+
Pulp::Connection::Handler.instance_for(:default_https,'bla','user','secret2').instance_variable_get('@https').should eql(true)
|
51
|
+
end
|
52
|
+
it "takes passed https setting" do
|
53
|
+
Pulp::Connection::Handler.instance_for(:default_https2,'bla','user2','secret2',false).instance_variable_get('@https').should eql(false)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe ".reset" do
|
58
|
+
it "removes a cached instance" do
|
59
|
+
a = Pulp::Connection::Handler.instance_for(:cache_reset)
|
60
|
+
Pulp::Connection::Handler.reset_instance(:cache_reset)
|
61
|
+
Pulp::Connection::Handler.instance_for(:cache_reset).should_not eql(a)
|
62
|
+
end
|
63
|
+
|
64
|
+
it "does not raise an error on an inexistant instance" do
|
65
|
+
lambda { Pulp::Connection::Handler.reset_instance(:blablablabla) }.should_not raise_error
|
66
|
+
end
|
67
|
+
end
|
68
|
+
describe ".reset_all" do
|
69
|
+
it "resets all connections" do
|
70
|
+
a = Pulp::Connection::Handler.instance_for(:cache_reset)
|
71
|
+
Pulp::Connection::Handler.send(:instances).should_not be_empty
|
72
|
+
Pulp::Connection::Handler.reset_all
|
73
|
+
Pulp::Connection::Handler.send(:instances).should be_empty
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe "an instance" do
|
78
|
+
let(:instance) do
|
79
|
+
Pulp::Connection::Handler.hostname = 'localhost'
|
80
|
+
Pulp::Connection::Handler.username = 'admin'
|
81
|
+
Pulp::Connection::Handler.password = 'admin'
|
82
|
+
Pulp::Connection::Handler.instance_for(:instance)
|
83
|
+
end
|
84
|
+
before(:each) { Pulp::Connection::Handler.reset_all }
|
85
|
+
describe "#parsed" do
|
86
|
+
it "gets the connection passed" do
|
87
|
+
instance.parsed{|conn| conn.should eql(instance.connection); DummyResult }
|
88
|
+
end
|
89
|
+
|
90
|
+
it "parses the result" do
|
91
|
+
instance.parsed{|conn| DummyResult }['a'].should eql(1)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe "#connection" do
|
96
|
+
it "'s url should match our url" do
|
97
|
+
instance.connection.url.should eql(instance.url)
|
98
|
+
end
|
99
|
+
it "'s user should match our username" do
|
100
|
+
instance.connection.user.should eql(Pulp::Connection::Handler.username)
|
101
|
+
end
|
102
|
+
it "'s passowrd should match our password" do
|
103
|
+
instance.connection.password.should eql(Pulp::Connection::Handler.password)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe "#api_path" do
|
108
|
+
it "is a fixed apth" do
|
109
|
+
instance.api_path.should eql("/pulp/api")
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
describe "#url" do
|
114
|
+
it "should be a full url depending on the identifier" do
|
115
|
+
instance.url.should eql("https://localhost/pulp/api/instances")
|
116
|
+
end
|
117
|
+
it "should depend on the https flag" do
|
118
|
+
i = Pulp::Connection::Handler.instance_for(:second_instance,'localhost','user','password',false)
|
119
|
+
i.url.should eql("http://localhost/pulp/api/second_instances")
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
3
|
+
|
4
|
+
describe Pulp::Content do
|
5
|
+
|
6
|
+
|
7
|
+
describe ".file" do
|
8
|
+
it "should get the file content of the passed id" do
|
9
|
+
Pulp::Content.expects(:base_get).with('','files/',{:id => 'ff'}).returns('a')
|
10
|
+
Pulp::Content.file('ff').should eql('a')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe ".delete_file" do
|
15
|
+
it "shold delete the file with the passed id" do
|
16
|
+
Pulp::Content.expects(:base_delete).with('','files/ff/',nil).returns(nil)
|
17
|
+
Pulp::Content.delete_file('ff').should be_nil
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|