sauce_whisk 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/Gemfile +1 -1
- data/README.md +28 -1
- data/Rakefile +8 -7
- data/changelog.markdown +6 -0
- data/lib/sauce_whisk.rb +1 -0
- data/lib/sauce_whisk/storage.rb +42 -0
- data/lib/sauce_whisk/version.rb +1 -1
- data/sauce_whisk.gemspec +16 -15
- data/spec/fixtures/vcr_cassettes/assets.yml +2 -2
- data/spec/fixtures/vcr_cassettes/storage.yml +52 -0
- data/spec/fixtures/vcr_cassettes/tunnels.yml +3 -3
- data/spec/fixtures/vcr_cassettes/tunnels_with_wait.yml +12 -12
- data/spec/lib/sauce_whisk/assets_spec.rb +2 -1
- data/spec/lib/sauce_whisk/job_spec.rb +2 -1
- data/spec/lib/sauce_whisk/jobs_spec.rb +5 -4
- data/spec/lib/sauce_whisk/storage_spec.rb +39 -0
- data/spec/lib/sauce_whisk/tunnels_spec.rb +6 -5
- metadata +42 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b58bf72d04b598a6481cf55f18f9e2e56303907a
|
4
|
+
data.tar.gz: 41b817b03dce1171362b43ac3de941da0e1ed7f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c06d53dc011a497b69825bc1cb2916765b146f5d03f85f510a8b48035959a0a6b5807bb2351b70ebf1506fa73c6c3d3f8e1ea9722312dbf360dd8ec61da087cb
|
7
|
+
data.tar.gz: a4ba5f66c7751d18e3dac1078e2aaed243d4c9ff31762d4f8d6926562f863708574eb4a6f017faed815256a37ad497a400a6ad5b9212c322b0be7074cb74e57a
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
SauceWhisk provides an "ActiveRecord" style client for the [Sauce Labs](http://www.saucelabs.com) RESTful API. If you're not using the [Sauce Gem](https://rubygems.org/gems/sauce) and you want a nice way to interact with our API, give this a try.
|
4
4
|
|
5
|
-
[![Build Status](https://travis-ci.org/
|
5
|
+
[![Build Status](https://travis-ci.org/saucelabs/sauce_whisk.svg?branch=v0.0.12)](https://travis-ci.org/saucelabs/sauce_whisk)
|
6
|
+
[![Dependency Status](https://gemnasium.com/saucelabs/sauce_whisk.svg)](https://gemnasium.com/saucelabs/sauce_whisk)
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
@@ -255,6 +256,32 @@ SauceWhisk.logger = my_logger
|
|
255
256
|
|
256
257
|
SauceWhisk.logger defaults to STDOUT.
|
257
258
|
|
259
|
+
### Storage
|
260
|
+
|
261
|
+
Create a new [storage object](http://saucelabs.com/docs/rest#storage):
|
262
|
+
|
263
|
+
```ruby
|
264
|
+
storage = SauceWhisk::Storage.new username: 'my_user_name', key: '00', debug: true
|
265
|
+
```
|
266
|
+
|
267
|
+
If the environment variables SAUCE_USERNAME and SAUCE_ACCESS_KEY are set then:
|
268
|
+
|
269
|
+
```ruby
|
270
|
+
storage = SauceStorage.new debug: true
|
271
|
+
```
|
272
|
+
|
273
|
+
List all files in storage.
|
274
|
+
|
275
|
+
```ruby
|
276
|
+
storage.files
|
277
|
+
```
|
278
|
+
|
279
|
+
Upload a file.
|
280
|
+
|
281
|
+
```ruby
|
282
|
+
storage.upload '/tmp/sauce/test.zip'
|
283
|
+
```
|
284
|
+
|
258
285
|
## Contributing
|
259
286
|
|
260
287
|
1. Fork the [sauce-labs version](https://github.com/saucelabs/sauce_whisk) of this repository
|
data/Rakefile
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
require
|
2
|
-
require "rake/testtask"
|
1
|
+
require 'rspec/core/rake_task'
|
3
2
|
|
4
3
|
Bundler::GemHelper.install_tasks
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
|
7
|
+
# If these are nil then the tests will fail
|
8
|
+
ENV['SAUCE_USERNAME'] ||= 'test_user'
|
9
|
+
ENV['SAUCE_ACCESS_KEY'] ||= 'test_key'
|
10
|
+
|
11
|
+
task :default => :spec
|
data/changelog.markdown
CHANGED
data/lib/sauce_whisk.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'restclient'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module SauceWhisk
|
6
|
+
class Storage
|
7
|
+
attr_reader :username, :key, :url, :debug
|
8
|
+
|
9
|
+
def initialize opts={}
|
10
|
+
@username = opts.fetch :username, ENV['SAUCE_USERNAME']
|
11
|
+
@key = opts.fetch :key, ENV['SAUCE_ACCESS_KEY']
|
12
|
+
@url = "https://#{@username}:#{@key}@saucelabs.com/rest/v1/storage/#{@username}"
|
13
|
+
@debug = opts.fetch :debug, false
|
14
|
+
end
|
15
|
+
|
16
|
+
def upload file_path
|
17
|
+
file_name = File.basename file_path
|
18
|
+
file = File.new file_path
|
19
|
+
local_md5 = Digest::MD5.hexdigest File.read file_path
|
20
|
+
|
21
|
+
self.files.each do |file|
|
22
|
+
if file['md5'] == local_md5
|
23
|
+
puts 'File already uploaded' if @debug
|
24
|
+
return true
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
url = "#{@url}/#{file_name}?overwrite=true"
|
29
|
+
remote_md5 = JSON.parse(RestClient.post url, file, content_type: 'application/octet-stream')['md5']
|
30
|
+
if @debug
|
31
|
+
puts "Uploaded #{file_path}"
|
32
|
+
puts " local_md5: #{local_md5}"
|
33
|
+
puts "remote_md5: #{remote_md5}"
|
34
|
+
end
|
35
|
+
local_md5 == remote_md5
|
36
|
+
end
|
37
|
+
|
38
|
+
def files
|
39
|
+
JSON.parse(RestClient.get @url)['files']
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/sauce_whisk/version.rb
CHANGED
data/sauce_whisk.gemspec
CHANGED
@@ -4,24 +4,25 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'sauce_whisk/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
|
-
gem.name
|
8
|
-
gem.version
|
9
|
-
gem.authors
|
10
|
-
gem.email
|
11
|
-
gem.description
|
12
|
-
gem.summary
|
13
|
-
gem.homepage
|
7
|
+
gem.name = 'sauce_whisk'
|
8
|
+
gem.version = SauceWhisk::VERSION
|
9
|
+
gem.authors = ['Dylan Lacey']
|
10
|
+
gem.email = ['github@dylanlacey.com']
|
11
|
+
gem.description = 'A Wrapper for the Sauce Labs REST API.'
|
12
|
+
gem.summary = "Sauce_Whisk lets you mix extra data into your Sauce test results!\nFetch and update Job details, screenshots, videos and logs."
|
13
|
+
gem.homepage = 'http://www.github.com/dylanlacey/sauce_whisk'
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
16
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
-
gem.require_paths = [
|
18
|
+
gem.require_paths = ['lib']
|
19
19
|
|
20
|
-
gem.license
|
20
|
+
gem.license = 'MIT'
|
21
21
|
|
22
|
-
gem.add_runtime_dependency
|
23
|
-
gem.
|
24
|
-
gem.add_development_dependency
|
25
|
-
gem.add_development_dependency
|
26
|
-
gem.add_development_dependency
|
22
|
+
gem.add_runtime_dependency 'rest-client', '~> 1.6.7'
|
23
|
+
gem.add_runtime_dependency 'json', '~> 1.8.1'
|
24
|
+
gem.add_development_dependency 'vcr', '~> 2.9.0'
|
25
|
+
gem.add_development_dependency 'webmock', '~> 1.17.4'
|
26
|
+
gem.add_development_dependency 'rspec', '~> 2.14.1'
|
27
|
+
gem.add_development_dependency 'rake', '~> 10.2.2'
|
27
28
|
end
|
@@ -161416,8 +161416,8 @@ http_interactions:
|
|
161416
161416
|
__read_body_previously_called: true
|
161417
161417
|
args:
|
161418
161418
|
:method: :get
|
161419
|
-
:url: https://saucelabs.com/rest/v1
|
161420
|
-
:user:
|
161419
|
+
:url: https://saucelabs.com/rest/v1/<SAUCE_USERNAME>/jobs/aaaaaaaaaaaaaaaa/assets/0000screenshot.png
|
161420
|
+
:user: <SAUCE_USERNAME>
|
161421
161421
|
:password: 8f5210dd-f0cf-477f-b720-9f721a9679a4
|
161422
161422
|
code: 404
|
161423
161423
|
http_version:
|
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://<SAUCE_USERNAME>:<SAUCE_ACCESS_KEY>@saucelabs.com/rest/v1/storage/<SAUCE_USERNAME>
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*; q=0.5, application/xml"
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx/0.7.62
|
23
|
+
Date:
|
24
|
+
- Sat, 29 Mar 2014 23:50:52 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Connection:
|
28
|
+
- keep-alive
|
29
|
+
Content-Length:
|
30
|
+
- '493'
|
31
|
+
Pragma:
|
32
|
+
- no-cache
|
33
|
+
Cache-Control:
|
34
|
+
- no-cache
|
35
|
+
X-Frame-Options:
|
36
|
+
- DENY
|
37
|
+
Set-Cookie:
|
38
|
+
- csrf_token=fed54bee6a2bf22dee60aac2da8b31f2; expires="Sun, 30-Mar-2014 00:00:52
|
39
|
+
GMT"; Max-Age=600; Path=/
|
40
|
+
- metrics=974bf180a3b44fef145643d9e5ba3d14a8ba13903a6e72303142445a86006cd55cb03290;
|
41
|
+
Path=/
|
42
|
+
body:
|
43
|
+
encoding: UTF-8
|
44
|
+
string: '{"files": [{"size": 4, "mtime": 1396136952.426505, "name": "temp.apk20140329-19108-1usvvg1",
|
45
|
+
"md5": "8d777f385d3dfec8815d20f7496026dc"}, {"size": 3084871, "mtime": 1396061123.5402322,
|
46
|
+
"name": "api.apk", "md5": "97abfd70c91d78110499fab2c4ac1cf5"}, {"size": 364743,
|
47
|
+
"mtime": 1396135230.241059, "name": "UICatalog6.1.app.zip", "md5": "e59c57d7406118dc6160cd8caa2a7cc5"},
|
48
|
+
{"size": 4, "mtime": 1396136951.9545088, "name": "temp.apk20140329-19108-e6ddx",
|
49
|
+
"md5": "8d777f385d3dfec8815d20f7496026dc"}]}'
|
50
|
+
http_version:
|
51
|
+
recorded_at: Sat, 29 Mar 2014 23:50:52 GMT
|
52
|
+
recorded_with: VCR 2.9.0
|
@@ -270,13 +270,13 @@ http_interactions:
|
|
270
270
|
__read_body_previously_called: true
|
271
271
|
args:
|
272
272
|
:method: :post
|
273
|
-
:url: https://saucelabs.com/rest/v1
|
273
|
+
:url: https://saucelabs.com/rest/v1/<SAUCE_USERNAME>/tunnels
|
274
274
|
:content_type: application/json
|
275
275
|
:headers:
|
276
276
|
Content-Length: 85
|
277
277
|
:payload: '{"tunnel_identifier":"bees","ssh_port":9123,"use_caching_proxy":false,"use_kgp":true}'
|
278
|
-
:user:
|
279
|
-
:password:
|
278
|
+
:user: <SAUCE_USERNAME>
|
279
|
+
:password: <SAUCE_ACCESS_KEY>
|
280
280
|
code: 200
|
281
281
|
http_version:
|
282
282
|
recorded_at: Tue, 30 Jul 2013 08:46:35 GMT
|
@@ -80,13 +80,13 @@ http_interactions:
|
|
80
80
|
__read_body_previously_called: true
|
81
81
|
args:
|
82
82
|
:method: :post
|
83
|
-
:url: https://saucelabs.com/rest/v1
|
83
|
+
:url: https://saucelabs.com/rest/v1/<SAUCE_USERNAME>/tunnels
|
84
84
|
:content_type: application/json
|
85
85
|
:headers:
|
86
86
|
Content-Length: 85
|
87
87
|
:payload: '{"tunnel_identifier":"bees","ssh_port":9123,"use_caching_proxy":false,"use_kgp":true}'
|
88
|
-
:user:
|
89
|
-
:password:
|
88
|
+
:user: <SAUCE_USERNAME>
|
89
|
+
:password: <SAUCE_ACCESS_KEY>
|
90
90
|
code: 200
|
91
91
|
http_version:
|
92
92
|
recorded_at: Tue, 30 Jul 2013 08:46:35 GMT
|
@@ -168,9 +168,9 @@ http_interactions:
|
|
168
168
|
__read_body_previously_called: true
|
169
169
|
args:
|
170
170
|
:method: :get
|
171
|
-
:url: https://saucelabs.com/rest/v1
|
172
|
-
:user:
|
173
|
-
:password:
|
171
|
+
:url: https://saucelabs.com/rest/v1/<SAUCE_USERNAME>/tunnels/4824d6b282e04d1184daff5401a52e1e
|
172
|
+
:user: <SAUCE_USERNAME>
|
173
|
+
:password: <SAUCE_ACCESS_KEY>
|
174
174
|
code: 200
|
175
175
|
http_version:
|
176
176
|
recorded_at: Thu, 01 Aug 2013 03:28:18 GMT
|
@@ -252,9 +252,9 @@ http_interactions:
|
|
252
252
|
__read_body_previously_called: true
|
253
253
|
args:
|
254
254
|
:method: :get
|
255
|
-
:url: https://saucelabs.com/rest/v1
|
256
|
-
:user:
|
257
|
-
:password:
|
255
|
+
:url: https://saucelabs.com/rest/v1/<SAUCE_USERNAME>/tunnels/4824d6b282e04d1184daff5401a52e1e
|
256
|
+
:user: <SAUCE_USERNAME>
|
257
|
+
:password: <SAUCE_ACCESS_KEY>
|
258
258
|
code: 200
|
259
259
|
http_version:
|
260
260
|
recorded_at: Thu, 01 Aug 2013 06:31:36 GMT
|
@@ -336,9 +336,9 @@ http_interactions:
|
|
336
336
|
__read_body_previously_called: true
|
337
337
|
args:
|
338
338
|
:method: :get
|
339
|
-
:url: https://saucelabs.com/rest/v1
|
340
|
-
:user:
|
341
|
-
:password:
|
339
|
+
:url: https://saucelabs.com/rest/v1/<SAUCE_USERNAME>/tunnels/4824d6b282e04d1184daff5401a52e1e
|
340
|
+
:user: <SAUCE_USERNAME>
|
341
|
+
:password: <SAUCE_ACCESS_KEY>
|
342
342
|
code: 200
|
343
343
|
http_version:
|
344
344
|
recorded_at: Thu, 01 Aug 2013 06:32:36 GMT
|
@@ -2,6 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe SauceWhisk::Assets do
|
4
4
|
let(:auth) {"#{ENV["SAUCE_USERNAME"]}:#{ENV["SAUCE_ACCESS_KEY"]}"}
|
5
|
+
let(:user) {ENV["SAUCE_USERNAME"]}
|
5
6
|
|
6
7
|
describe "#fetch", :vcr => {:cassette_name => "assets"} do
|
7
8
|
let(:job_id) {"bd9c43dd6b5549f1b942d1d581d98cac"}
|
@@ -10,7 +11,7 @@ describe SauceWhisk::Assets do
|
|
10
11
|
it "fetches an asset for the requested job" do
|
11
12
|
SauceWhisk::Assets.fetch job_id, asset_name
|
12
13
|
|
13
|
-
assert_requested :get, "https://#{auth}@saucelabs.com/rest/v1/
|
14
|
+
assert_requested :get, "https://#{auth}@saucelabs.com/rest/v1/#{user}/jobs/#{job_id}/assets/#{asset_name}"
|
14
15
|
end
|
15
16
|
|
16
17
|
it "returns an asset" do
|
@@ -2,6 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe SauceWhisk::Job do
|
4
4
|
let(:job) {SauceWhisk::Job.new}
|
5
|
+
let(:user) {ENV["SAUCE_USERNAME"]}
|
5
6
|
subject {SauceWhisk::Job.new}
|
6
7
|
|
7
8
|
it {should respond_to :id}
|
@@ -71,7 +72,7 @@ describe SauceWhisk::Job do
|
|
71
72
|
|
72
73
|
it "Calls the correct REST API method", :vcr => {:cassette_name => "jobs"} do
|
73
74
|
subject.stop
|
74
|
-
assert_requested :put, "https://#{
|
75
|
+
assert_requested :put, "https://#{user}:#{ENV["SAUCE_ACCESS_KEY"]}@saucelabs.com/rest/v1/#{user}/jobs/#{subject.id}/stop"
|
75
76
|
end
|
76
77
|
end
|
77
78
|
|
@@ -2,6 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe SauceWhisk::Jobs do
|
4
4
|
let(:auth) {"#{ENV["SAUCE_USERNAME"]}:#{ENV["SAUCE_ACCESS_KEY"]}"}
|
5
|
+
let(:user) {ENV["SAUCE_USERNAME"]}
|
5
6
|
describe "#all", :vcr => {:cassette_name => 'jobs'} do
|
6
7
|
|
7
8
|
it "should return an enumerable" do
|
@@ -23,7 +24,7 @@ describe SauceWhisk::Jobs do
|
|
23
24
|
it "passes a test status to the REST api" do
|
24
25
|
job_id = "bd9c43dd6b5549f1b942d1d581d98cac"
|
25
26
|
SauceWhisk::Jobs.change_status job_id, true
|
26
|
-
assert_requested :put, "https://#{auth}@saucelabs.com/rest/v1/
|
27
|
+
assert_requested :put, "https://#{auth}@saucelabs.com/rest/v1/#{user}/jobs/#{job_id}", :body => pass_string, :content_type => "application/json"
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
@@ -50,7 +51,7 @@ describe SauceWhisk::Jobs do
|
|
50
51
|
job_id = "bd9c43dd6b5549f1b942d1d581d98cac"
|
51
52
|
job = SauceWhisk::Job.new({:id => job_id})
|
52
53
|
SauceWhisk::Jobs.save (job)
|
53
|
-
assert_requested :put, "https://#{auth}@saucelabs.com/rest/v1/
|
54
|
+
assert_requested :put, "https://#{auth}@saucelabs.com/rest/v1/#{user}/jobs/#{job.id}", :body => anything, :content_type => "application/json"
|
54
55
|
end
|
55
56
|
|
56
57
|
it "only sends updated information" do
|
@@ -59,7 +60,7 @@ describe SauceWhisk::Jobs do
|
|
59
60
|
job.name = "Updated Name"
|
60
61
|
SauceWhisk::Jobs.save (job)
|
61
62
|
expected_body = {:name => "Updated Name"}.to_json
|
62
|
-
assert_requested :put, "https://#{auth}@saucelabs.com/rest/v1/
|
63
|
+
assert_requested :put, "https://#{auth}@saucelabs.com/rest/v1/#{user}/jobs/#{job.id}", :body => expected_body, :content_type => "application/json"
|
63
64
|
end
|
64
65
|
end
|
65
66
|
|
@@ -79,7 +80,7 @@ describe SauceWhisk::Jobs do
|
|
79
80
|
describe "##stop", :vcr => {:cassette_name => "jobs"} do
|
80
81
|
it "calls the API correctly" do
|
81
82
|
SauceWhisk::Jobs.stop "3edc8fe6d52645bf931b1003da65af1f"
|
82
|
-
assert_requested :put, "https://#{auth}@saucelabs.com/rest/v1/
|
83
|
+
assert_requested :put, "https://#{auth}@saucelabs.com/rest/v1/#{user}/jobs/3edc8fe6d52645bf931b1003da65af1f/stop", :content_type => "application/json"
|
83
84
|
end
|
84
85
|
|
85
86
|
it "does something interesting when the job is already stopped" do
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SauceWhisk::Storage, :vcr => { :cassette_name => 'storage' } do
|
4
|
+
before do
|
5
|
+
@file_name = 'temp.apk'
|
6
|
+
@temp_file = Tempfile.new @file_name
|
7
|
+
|
8
|
+
begin
|
9
|
+
@temp_file.write 'data'
|
10
|
+
ensure
|
11
|
+
@temp_file.close
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
after do
|
16
|
+
@temp_file.unlink
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'uploads a file with username and key' do
|
20
|
+
storage = SauceWhisk::Storage.new username: ENV['SAUCE_USERNAME'], key: ENV['SAUCE_ACCESS_KEY']
|
21
|
+
storage.upload @temp_file
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'uploads a file with implicit auth' do
|
25
|
+
storage = SauceWhisk::Storage.new
|
26
|
+
storage.upload @temp_file
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'lists all uploaded files' do
|
30
|
+
storage = SauceWhisk::Storage.new
|
31
|
+
files = storage.files
|
32
|
+
expect(files.length).to be > 1
|
33
|
+
|
34
|
+
upload_successful = files.any? do |file|
|
35
|
+
file['name'].include?(@file_name)
|
36
|
+
end
|
37
|
+
expect(upload_successful).to be true
|
38
|
+
end
|
39
|
+
end
|
@@ -2,11 +2,12 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe SauceWhisk::Tunnels, :vcr => {:cassette_name => "tunnels"} do
|
4
4
|
let(:auth) {"#{ENV["SAUCE_USERNAME"]}:#{ENV["SAUCE_ACCESS_KEY"]}"}
|
5
|
+
let(:user) {ENV["SAUCE_USERNAME"]}
|
5
6
|
|
6
7
|
describe "##all" do
|
7
8
|
it "lists all tunnels a user has open" do
|
8
9
|
SauceWhisk::Tunnels.all
|
9
|
-
assert_requested :get, "https://#{auth}@saucelabs.com/rest/v1/
|
10
|
+
assert_requested :get, "https://#{auth}@saucelabs.com/rest/v1/#{user}/tunnels"
|
10
11
|
end
|
11
12
|
|
12
13
|
it "returns nothing when no tunnels are found", :vcr => {:cassette_name => "no_tunnels", :exclusive => true} do
|
@@ -35,7 +36,7 @@ describe SauceWhisk::Tunnels, :vcr => {:cassette_name => "tunnels"} do
|
|
35
36
|
let(:job_id) {"fcf7b980037b4a37aa5ff19808e46da7"}
|
36
37
|
it "fetches a single instance of a tunnel" do
|
37
38
|
SauceWhisk::Tunnels.fetch job_id
|
38
|
-
assert_requested :get, "https://#{auth}@saucelabs.com/rest/v1/
|
39
|
+
assert_requested :get, "https://#{auth}@saucelabs.com/rest/v1/#{user}/tunnels/#{job_id}"
|
39
40
|
end
|
40
41
|
|
41
42
|
it "returns instances of Tunnel" do
|
@@ -52,7 +53,7 @@ describe SauceWhisk::Tunnels, :vcr => {:cassette_name => "tunnels"} do
|
|
52
53
|
it "calls the correct API method" do
|
53
54
|
tunnel_id = "7a4815f52407435581517ffd4d71c3a7"
|
54
55
|
SauceWhisk::Tunnels.stop tunnel_id
|
55
|
-
assert_requested :delete, "https://#{auth}@saucelabs.com/rest/v1/
|
56
|
+
assert_requested :delete, "https://#{auth}@saucelabs.com/rest/v1/#{user}/tunnels/#{tunnel_id}"
|
56
57
|
end
|
57
58
|
end
|
58
59
|
|
@@ -60,7 +61,7 @@ describe SauceWhisk::Tunnels, :vcr => {:cassette_name => "tunnels"} do
|
|
60
61
|
let(:params) {{:tunnel_identifier => "bees", :ssh_port => 9123, :use_caching_proxy => false, :use_kgp => true}}
|
61
62
|
it "calls the correct API method" do
|
62
63
|
SauceWhisk::Tunnels.open params
|
63
|
-
assert_requested(:post, "https://#{auth}@saucelabs.com/rest/v1/
|
64
|
+
assert_requested(:post, "https://#{auth}@saucelabs.com/rest/v1/#{user}/tunnels",:body => params.to_json)
|
64
65
|
end
|
65
66
|
|
66
67
|
it "returns an instance of tunnel" do
|
@@ -78,7 +79,7 @@ describe SauceWhisk::Tunnels, :vcr => {:cassette_name => "tunnels"} do
|
|
78
79
|
t_id = requested_tunnel.id
|
79
80
|
|
80
81
|
# There are 3 failing and 1 passing examples in the fixture
|
81
|
-
assert_requested :get, "https://#{auth}@saucelabs.com/rest/v1/
|
82
|
+
assert_requested :get, "https://#{auth}@saucelabs.com/rest/v1/#{user}/tunnels/#{t_id}", :times => 4
|
82
83
|
end
|
83
84
|
|
84
85
|
it "throws an exception if the timeout is exceeded" do
|
metadata
CHANGED
@@ -1,85 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sauce_whisk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Lacey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.6.7
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.6.7
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.8.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.8.1
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: vcr
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- - "
|
45
|
+
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
47
|
+
version: 2.9.0
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- - "
|
52
|
+
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
54
|
+
version: 2.9.0
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: webmock
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - "
|
59
|
+
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
61
|
+
version: 1.17.4
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
68
|
+
version: 1.17.4
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - "
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
75
|
+
version: 2.14.1
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - "
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: 2.14.1
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - "
|
87
|
+
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: 10.2.2
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - "
|
94
|
+
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
96
|
+
version: 10.2.2
|
83
97
|
description: A Wrapper for the Sauce Labs REST API.
|
84
98
|
email:
|
85
99
|
- github@dylanlacey.com
|
@@ -91,6 +105,7 @@ files:
|
|
91
105
|
- ".rspec"
|
92
106
|
- ".ruby-gemset"
|
93
107
|
- ".ruby-version"
|
108
|
+
- ".travis.yml"
|
94
109
|
- Gemfile
|
95
110
|
- LICENSE.txt
|
96
111
|
- README.md
|
@@ -102,6 +117,7 @@ files:
|
|
102
117
|
- lib/sauce_whisk/info.rb
|
103
118
|
- lib/sauce_whisk/jobs.rb
|
104
119
|
- lib/sauce_whisk/rest_request_builder.rb
|
120
|
+
- lib/sauce_whisk/storage.rb
|
105
121
|
- lib/sauce_whisk/tunnels.rb
|
106
122
|
- lib/sauce_whisk/version.rb
|
107
123
|
- sauce_whisk.gemspec
|
@@ -112,6 +128,7 @@ files:
|
|
112
128
|
- spec/fixtures/vcr_cassettes/no_jobs.yml
|
113
129
|
- spec/fixtures/vcr_cassettes/no_tunnels.yml
|
114
130
|
- spec/fixtures/vcr_cassettes/rest_request.yml
|
131
|
+
- spec/fixtures/vcr_cassettes/storage.yml
|
115
132
|
- spec/fixtures/vcr_cassettes/tunnels.yml
|
116
133
|
- spec/fixtures/vcr_cassettes/tunnels_with_wait.yml
|
117
134
|
- spec/lib/sauce_whisk/account_spec.rb
|
@@ -123,6 +140,7 @@ files:
|
|
123
140
|
- spec/lib/sauce_whisk/jobs_spec.rb
|
124
141
|
- spec/lib/sauce_whisk/rest_request_builder_spec.rb
|
125
142
|
- spec/lib/sauce_whisk/sauce_whisk_spec.rb
|
143
|
+
- spec/lib/sauce_whisk/storage_spec.rb
|
126
144
|
- spec/lib/sauce_whisk/subaccounts_spec.rb
|
127
145
|
- spec/lib/sauce_whisk/tunnel_spec.rb
|
128
146
|
- spec/lib/sauce_whisk/tunnels_spec.rb
|
@@ -160,6 +178,7 @@ test_files:
|
|
160
178
|
- spec/fixtures/vcr_cassettes/no_jobs.yml
|
161
179
|
- spec/fixtures/vcr_cassettes/no_tunnels.yml
|
162
180
|
- spec/fixtures/vcr_cassettes/rest_request.yml
|
181
|
+
- spec/fixtures/vcr_cassettes/storage.yml
|
163
182
|
- spec/fixtures/vcr_cassettes/tunnels.yml
|
164
183
|
- spec/fixtures/vcr_cassettes/tunnels_with_wait.yml
|
165
184
|
- spec/lib/sauce_whisk/account_spec.rb
|
@@ -171,6 +190,7 @@ test_files:
|
|
171
190
|
- spec/lib/sauce_whisk/jobs_spec.rb
|
172
191
|
- spec/lib/sauce_whisk/rest_request_builder_spec.rb
|
173
192
|
- spec/lib/sauce_whisk/sauce_whisk_spec.rb
|
193
|
+
- spec/lib/sauce_whisk/storage_spec.rb
|
174
194
|
- spec/lib/sauce_whisk/subaccounts_spec.rb
|
175
195
|
- spec/lib/sauce_whisk/tunnel_spec.rb
|
176
196
|
- spec/lib/sauce_whisk/tunnels_spec.rb
|