studio_api 3.0.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/studio_api/testdrive.rb +27 -0
- data/lib/studio_api.rb +1 -0
- data/test/gallery_test.rb +1 -1
- data/test/responses/testdrive.xml +13 -0
- data/test/responses/testdrives.xml +7 -0
- data/test/testdrive_test.rb +38 -0
- metadata +56 -49
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0
|
1
|
+
3.1.0
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "studio_api/studio_resource"
|
2
|
+
|
3
|
+
module StudioApi
|
4
|
+
class Testdrive < ActiveResource::Base
|
5
|
+
# Testdrives
|
6
|
+
#
|
7
|
+
# @example Run a build in testdrive
|
8
|
+
# StudioApi::Testdrive.create(:build_id => 1234)
|
9
|
+
extend StudioResource
|
10
|
+
|
11
|
+
self.element_name = "testdrive"
|
12
|
+
undef_method :delete
|
13
|
+
|
14
|
+
private
|
15
|
+
#overwrite create as studio doesn't interact well with enclosed parameters
|
16
|
+
def create
|
17
|
+
request_str = collection_path
|
18
|
+
request_str << "?build_id=#{attributes.delete("build_id").to_i}"
|
19
|
+
attributes.each do |k,v|
|
20
|
+
request_str << "&#{CGI.escape k.to_s}=#{CGI.escape v.to_s}"
|
21
|
+
end
|
22
|
+
connection.post(request_str,"",self.class.headers).tap do |response|
|
23
|
+
load_attributes_from_response response
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/studio_api.rb
CHANGED
data/test/gallery_test.rb
CHANGED
@@ -29,7 +29,7 @@ class GalleryTest < Test::Unit::TestCase
|
|
29
29
|
gallery_out = respond_load "gallery.xml"
|
30
30
|
StudioApi::GenericRequest.any_instance.stubs(:get).with("/gallery/appliances?popular&per_page=10").returns(gallery_out)
|
31
31
|
out = StudioApi::Gallery.find_appliance :popular, :per_page => 10
|
32
|
-
|
32
|
+
assert_equal 10, out[:appliances].size
|
33
33
|
end
|
34
34
|
|
35
35
|
def test_appliance
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<testdrive>
|
2
|
+
<id>1234</id>
|
3
|
+
<state>new</state>
|
4
|
+
<build_id>12345</build_id>
|
5
|
+
<url>http://node52.susestudio.com/testdrive/testdrive/start/11/22/abcdefgh1234567890</url>
|
6
|
+
<server>
|
7
|
+
<vnc>
|
8
|
+
<host>node52.susestudio.com</host>
|
9
|
+
<port>5902</port>
|
10
|
+
<password>1234567890</password>
|
11
|
+
</vnc>
|
12
|
+
</server>
|
13
|
+
</testdrive>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'active_support'
|
3
|
+
require 'active_resource/http_mock'
|
4
|
+
require 'mocha'
|
5
|
+
require 'test/unit'
|
6
|
+
$:.unshift File.join( File.dirname(__FILE__), '..', 'lib')
|
7
|
+
require 'studio_api/testdrive'
|
8
|
+
require 'studio_api/connection'
|
9
|
+
|
10
|
+
class TestdriveTest < Test::Unit::TestCase
|
11
|
+
BUILD_ID = 12345
|
12
|
+
|
13
|
+
def respond_load name
|
14
|
+
IO.read(File.join(File.dirname(__FILE__), "responses", name))
|
15
|
+
end
|
16
|
+
|
17
|
+
def setup
|
18
|
+
@connection = StudioApi::Connection.new("test", "test", "http://localhost")
|
19
|
+
StudioApi::Testdrive.studio_connection = @connection
|
20
|
+
|
21
|
+
testdrives_out = respond_load "testdrives.xml"
|
22
|
+
testdrive_out = respond_load "testdrive.xml"
|
23
|
+
|
24
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
25
|
+
mock.get "/testdrives", {"Authorization"=>"Basic dGVzdDp0ZXN0"}, testdrives_out, 200
|
26
|
+
mock.post "/testdrives?build_id=#{BUILD_ID}", {"Authorization"=>"Basic dGVzdDp0ZXN0"}, testdrive_out, 200
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_find
|
31
|
+
res = StudioApi::Testdrive.all
|
32
|
+
assert_equal 1, res.size
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_new
|
36
|
+
assert StudioApi::Testdrive.new(:build_id => BUILD_ID).save
|
37
|
+
end
|
38
|
+
end
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 3.0.2
|
10
|
+
version: 3.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Josef Reidinger
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-05-02 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- lib/studio_api/running_build.rb
|
84
84
|
- lib/studio_api/studio_resource.rb
|
85
85
|
- lib/studio_api/template_set.rb
|
86
|
+
- lib/studio_api/testdrive.rb
|
86
87
|
- lib/studio_api/util.rb
|
87
88
|
- test/appliance_test.rb
|
88
89
|
- test/build_test.rb
|
@@ -95,34 +96,37 @@ files:
|
|
95
96
|
- test/rpm_test.rb
|
96
97
|
- test/running_build_test.rb
|
97
98
|
- test/template_set_test.rb
|
99
|
+
- test/testdrive_test.rb
|
98
100
|
- test/responses/appliance.xml
|
99
|
-
- test/responses/gpg_key.xml
|
100
|
-
- test/responses/status-broken.xml
|
101
|
-
- test/responses/configuration.xml
|
102
|
-
- test/responses/template_sets.xml
|
103
|
-
- test/responses/users_0.xml
|
104
101
|
- test/responses/appliances.xml
|
102
|
+
- test/responses/build.xml
|
103
|
+
- test/responses/builds.xml
|
104
|
+
- test/responses/configuration.xml
|
105
105
|
- test/responses/file.xml
|
106
|
-
- test/responses/
|
107
|
-
- test/responses/users_1.xml
|
108
|
-
- test/responses/users_2.xml
|
106
|
+
- test/responses/files.xml
|
109
107
|
- test/responses/gallery.xml
|
110
|
-
- test/responses/rpm.xml
|
111
|
-
- test/responses/status.xml
|
112
108
|
- test/responses/gallery_appliance.xml
|
113
|
-
- test/responses/
|
114
|
-
- test/responses/running_build.xml
|
115
|
-
- test/responses/files.xml
|
116
|
-
- test/responses/rpms.xml
|
109
|
+
- test/responses/gpg_key.xml
|
117
110
|
- test/responses/gpg_keys.xml
|
118
|
-
- test/responses/versions.xml
|
119
111
|
- test/responses/manifest.xml
|
112
|
+
- test/responses/repositories.xml
|
113
|
+
- test/responses/repository.xml
|
114
|
+
- test/responses/rpm.xml
|
115
|
+
- test/responses/rpms.xml
|
116
|
+
- test/responses/running_build.xml
|
117
|
+
- test/responses/running_builds.xml
|
118
|
+
- test/responses/software.xml
|
120
119
|
- test/responses/software_installed.xml
|
121
120
|
- test/responses/software_search.xml
|
122
|
-
- test/responses/
|
123
|
-
- test/responses/
|
124
|
-
- test/responses/
|
125
|
-
- test/responses/
|
121
|
+
- test/responses/status-broken.xml
|
122
|
+
- test/responses/status.xml
|
123
|
+
- test/responses/template_sets.xml
|
124
|
+
- test/responses/testdrive.xml
|
125
|
+
- test/responses/testdrives.xml
|
126
|
+
- test/responses/users_0.xml
|
127
|
+
- test/responses/users_1.xml
|
128
|
+
- test/responses/users_2.xml
|
129
|
+
- test/responses/versions.xml
|
126
130
|
has_rdoc: true
|
127
131
|
homepage: http://github.com/jreidinger/studio_api
|
128
132
|
licenses:
|
@@ -156,47 +160,50 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
160
|
requirements: []
|
157
161
|
|
158
162
|
rubyforge_project:
|
159
|
-
rubygems_version: 1.5.
|
163
|
+
rubygems_version: 1.5.1
|
160
164
|
signing_key:
|
161
165
|
specification_version: 3
|
162
166
|
summary: Intuitive ruby bindings to Studio Api Interface.
|
163
167
|
test_files:
|
164
|
-
- test/
|
165
|
-
- test/resource_test.rb
|
166
|
-
- test/generic_request_test.rb
|
167
|
-
- test/repository_test.rb
|
168
|
-
- test/template_set_test.rb
|
168
|
+
- test/appliance_test.rb
|
169
169
|
- test/build_test.rb
|
170
|
-
- test/rpm_test.rb
|
171
170
|
- test/connection_test.rb
|
172
171
|
- test/file_test.rb
|
173
|
-
- test/appliance_test.rb
|
174
172
|
- test/gallery_test.rb
|
173
|
+
- test/generic_request_test.rb
|
174
|
+
- test/repository_test.rb
|
175
|
+
- test/resource_test.rb
|
175
176
|
- test/responses/appliance.xml
|
176
|
-
- test/responses/gpg_key.xml
|
177
|
-
- test/responses/status-broken.xml
|
178
|
-
- test/responses/configuration.xml
|
179
|
-
- test/responses/template_sets.xml
|
180
|
-
- test/responses/users_0.xml
|
181
177
|
- test/responses/appliances.xml
|
178
|
+
- test/responses/build.xml
|
179
|
+
- test/responses/builds.xml
|
180
|
+
- test/responses/configuration.xml
|
182
181
|
- test/responses/file.xml
|
183
|
-
- test/responses/
|
184
|
-
- test/responses/users_1.xml
|
185
|
-
- test/responses/users_2.xml
|
182
|
+
- test/responses/files.xml
|
186
183
|
- test/responses/gallery.xml
|
187
|
-
- test/responses/rpm.xml
|
188
|
-
- test/responses/status.xml
|
189
184
|
- test/responses/gallery_appliance.xml
|
190
|
-
- test/responses/
|
191
|
-
- test/responses/running_build.xml
|
192
|
-
- test/responses/files.xml
|
193
|
-
- test/responses/rpms.xml
|
185
|
+
- test/responses/gpg_key.xml
|
194
186
|
- test/responses/gpg_keys.xml
|
195
|
-
- test/responses/versions.xml
|
196
187
|
- test/responses/manifest.xml
|
188
|
+
- test/responses/repositories.xml
|
189
|
+
- test/responses/repository.xml
|
190
|
+
- test/responses/rpm.xml
|
191
|
+
- test/responses/rpms.xml
|
192
|
+
- test/responses/running_build.xml
|
193
|
+
- test/responses/running_builds.xml
|
194
|
+
- test/responses/software.xml
|
197
195
|
- test/responses/software_installed.xml
|
198
196
|
- test/responses/software_search.xml
|
199
|
-
- test/responses/
|
200
|
-
- test/responses/
|
201
|
-
- test/responses/
|
202
|
-
- test/responses/
|
197
|
+
- test/responses/status-broken.xml
|
198
|
+
- test/responses/status.xml
|
199
|
+
- test/responses/template_sets.xml
|
200
|
+
- test/responses/testdrive.xml
|
201
|
+
- test/responses/testdrives.xml
|
202
|
+
- test/responses/users_0.xml
|
203
|
+
- test/responses/users_1.xml
|
204
|
+
- test/responses/users_2.xml
|
205
|
+
- test/responses/versions.xml
|
206
|
+
- test/rpm_test.rb
|
207
|
+
- test/running_build_test.rb
|
208
|
+
- test/template_set_test.rb
|
209
|
+
- test/testdrive_test.rb
|