tugboat 2.2.4 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +284 -274
- data/README.md +1 -1
- data/features/cassettes/config/Array_of_SSH_Keys_in_Config.yml +1 -1
- data/features/cassettes/config/Single_SSH_key_as_number_in_config.yml +1 -1
- data/lib/tugboat.rb +4 -0
- data/lib/tugboat/middleware/create_droplet.rb +1 -1
- data/lib/tugboat/middleware/custom_logger.rb +3 -1
- data/lib/tugboat/middleware/inject_client.rb +3 -0
- data/lib/tugboat/middleware/list_regions.rb +2 -2
- data/lib/tugboat/middleware/list_sizes.rb +2 -2
- data/lib/tugboat/version.rb +1 -1
- data/license/dependency_decisions.yml +6 -0
- data/spec/cli/authorize_cli_spec.rb +2 -2
- data/spec/cli/create_cli_spec.rb +10 -10
- data/spec/cli/debug_cli_spec.rb +4 -4
- data/spec/cli/destroy_cli_spec.rb +14 -14
- data/spec/cli/destroy_image_cli_spec.rb +8 -8
- data/spec/cli/droplets_cli_spec.rb +13 -13
- data/spec/cli/env_variable_spec.rb +2 -2
- data/spec/cli/halt_cli_spec.rb +15 -15
- data/spec/cli/images_cli_spec.rb +6 -6
- data/spec/cli/info_cli_spec.rb +32 -32
- data/spec/cli/info_image_cli_spec.rb +13 -13
- data/spec/cli/keys_cli_spec.rb +1 -1
- data/spec/cli/password_reset_cli_spec.rb +13 -13
- data/spec/cli/rebuild_cli_spec.rb +48 -48
- data/spec/cli/regions_cli_spec.rb +3 -3
- data/spec/cli/resize_cli_spec.rb +12 -12
- data/spec/cli/restart_cli_spec.rb +12 -12
- data/spec/cli/sizes_cli_spec.rb +2 -2
- data/spec/cli/snapshot_cli_spec.rb +11 -11
- data/spec/cli/ssh_cli_spec.rb +6 -6
- data/spec/cli/start_cli_spec.rb +11 -11
- data/spec/cli/verify_cli_spec.rb +3 -3
- data/spec/cli/wait_cli_spec.rb +11 -11
- data/spec/middleware/check_credentials_spec.rb +1 -1
- data/spec/middleware/inject_client_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -0
- data/tugboat.gemspec +3 -1
- metadata +34 -6
@@ -6,7 +6,7 @@ describe Tugboat::CLI do
|
|
6
6
|
describe 'DO_API_TOKEN=foobar' do
|
7
7
|
it 'verifies with the ENV variable DO_API_TOKEN' do
|
8
8
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
9
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer env_variable', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
9
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer env_variable', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
10
10
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
11
11
|
|
12
12
|
allow(ENV).to receive(:[]).with('HOME').and_return('/tmp/fake_home')
|
@@ -22,7 +22,7 @@ describe Tugboat::CLI do
|
|
22
22
|
|
23
23
|
it 'does not use ENV variable DO_API_TOKEN if empty' do
|
24
24
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
25
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
25
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
26
26
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
27
27
|
|
28
28
|
allow(ENV).to receive(:[]).with('HOME').and_return('/tmp/fake_home')
|
data/spec/cli/halt_cli_spec.rb
CHANGED
@@ -6,16 +6,16 @@ describe Tugboat::CLI do
|
|
6
6
|
describe 'halt' do
|
7
7
|
it 'halts a droplet with a fuzzy name' do
|
8
8
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
9
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
9
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
10
10
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
11
11
|
|
12
12
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
13
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
13
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
14
14
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
15
15
|
|
16
16
|
stub_request(:post, 'https://api.digitalocean.com/v2/droplets/6918990/actions').
|
17
17
|
with(body: '{"type":"shutdown"}',
|
18
|
-
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
18
|
+
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
19
19
|
to_return(status: 200, body: fixture('shutdown_response'), headers: {})
|
20
20
|
|
21
21
|
cli.halt('example.com')
|
@@ -28,16 +28,16 @@ Queuing shutdown for 6918990 (example.com)...Halt successful!
|
|
28
28
|
|
29
29
|
it 'halts a droplet hard when the hard option is used' do
|
30
30
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
31
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
31
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
32
32
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
33
33
|
|
34
34
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
35
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
35
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
36
36
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
37
37
|
|
38
38
|
stub_request(:post, 'https://api.digitalocean.com/v2/droplets/6918990/actions').
|
39
39
|
with(body: '{"type":"power_off"}',
|
40
|
-
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
40
|
+
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
41
41
|
to_return(status: 200, body: '', headers: {})
|
42
42
|
|
43
43
|
cli.options = cli.options.merge(hard: true)
|
@@ -51,20 +51,20 @@ Queuing hard shutdown for 6918990 (example.com)...Halt successful!
|
|
51
51
|
|
52
52
|
it 'halts a droplet with an id' do
|
53
53
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
54
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
54
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
55
55
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
56
56
|
|
57
57
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/?per_page=200').
|
58
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
58
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
59
59
|
to_return(status: 200, body: fixture('show_droplets'), headers: { 'Content-Type' => 'application/json' })
|
60
60
|
|
61
61
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
62
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
62
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
63
63
|
to_return(status: 200, body: fixture('show_droplet'), headers: {})
|
64
64
|
|
65
65
|
stub_request(:post, 'https://api.digitalocean.com/v2/droplets/6918990/actions').
|
66
66
|
with(body: '{"type":"shutdown"}',
|
67
|
-
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
67
|
+
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
68
68
|
to_return(status: 200, body: fixture('shutdown_response'), headers: {})
|
69
69
|
|
70
70
|
cli.options = cli.options.merge(id: '6918990')
|
@@ -78,16 +78,16 @@ Queuing shutdown for 6918990 (example.com)...Halt successful!
|
|
78
78
|
|
79
79
|
it 'halts a droplet with a name' do
|
80
80
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
81
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
81
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
82
82
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
83
83
|
|
84
84
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
85
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
85
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
86
86
|
to_return(status: 200, body: fixture('show_droplets'), headers: { 'Content-Type' => 'application/json' })
|
87
87
|
|
88
88
|
stub_request(:post, 'https://api.digitalocean.com/v2/droplets/6918990/actions').
|
89
89
|
with(body: '{"type":"shutdown"}',
|
90
|
-
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
90
|
+
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
91
91
|
to_return(status: 200, body: fixture('shutdown_response'), headers: {})
|
92
92
|
|
93
93
|
cli.options = cli.options.merge(name: 'example.com')
|
@@ -101,11 +101,11 @@ Queuing shutdown for 6918990 (example.com)...Halt successful!
|
|
101
101
|
|
102
102
|
it 'does not halt a droplet that is off' do
|
103
103
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
104
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
104
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
105
105
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
106
106
|
|
107
107
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
108
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
108
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
109
109
|
to_return(status: 200, body: fixture('show_droplets'), headers: { 'Content-Type' => 'application/json' })
|
110
110
|
|
111
111
|
cli.options = cli.options.merge(name: 'example3.com')
|
data/spec/cli/images_cli_spec.rb
CHANGED
@@ -6,11 +6,11 @@ describe Tugboat::CLI do
|
|
6
6
|
describe 'images' do
|
7
7
|
it 'shows all images by default' do
|
8
8
|
stub_request(:get, 'https://api.digitalocean.com/v2/images?per_page=200').
|
9
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
9
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
10
10
|
to_return(status: 200, body: fixture('show_images'), headers: {})
|
11
11
|
|
12
12
|
stub_request(:get, 'https://api.digitalocean.com/v2/images?per_page=200&private=true').
|
13
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
13
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
14
14
|
to_return(status: 200, body: fixture('show_images_global'), headers: {})
|
15
15
|
|
16
16
|
cli.images
|
@@ -75,11 +75,11 @@ Redmine on 14.04 (slug: redmine, id: 12438838, distro: Ubuntu)
|
|
75
75
|
|
76
76
|
it 'acknowledges when personal images are empty when showing default full list' do
|
77
77
|
stub_request(:get, 'https://api.digitalocean.com/v2/images?per_page=200').
|
78
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
78
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
79
79
|
to_return(status: 200, body: fixture('show_images'), headers: {})
|
80
80
|
|
81
81
|
stub_request(:get, 'https://api.digitalocean.com/v2/images?per_page=200&private=true').
|
82
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
82
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
83
83
|
to_return(status: 200, body: fixture('show_images_empty'), headers: {})
|
84
84
|
|
85
85
|
cli.options = cli.options.merge(show_private_images: true)
|
@@ -145,11 +145,11 @@ Redmine on 14.04 (slug: redmine, id: 12438838, distro: Ubuntu)
|
|
145
145
|
|
146
146
|
it 'acknowledges when personal images are empty when just show private images flag given' do
|
147
147
|
stub_request(:get, 'https://api.digitalocean.com/v2/images?per_page=200').
|
148
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
148
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
149
149
|
to_return(status: 200, body: fixture('show_images'), headers: {})
|
150
150
|
|
151
151
|
stub_request(:get, 'https://api.digitalocean.com/v2/images?per_page=200&private=true').
|
152
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
152
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
153
153
|
to_return(status: 200, body: fixture('show_images_empty'), headers: {})
|
154
154
|
|
155
155
|
cli.options = cli.options.merge(show_just_private_images: true)
|
data/spec/cli/info_cli_spec.rb
CHANGED
@@ -6,11 +6,11 @@ describe Tugboat::CLI do
|
|
6
6
|
describe 'info' do
|
7
7
|
it 'shows an error if response is not successful' do
|
8
8
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
9
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
9
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
10
10
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
11
11
|
|
12
12
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
13
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
13
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
14
14
|
to_return(status: 404, body: fixture('not_found'), headers: {})
|
15
15
|
|
16
16
|
cli.options = cli.options.merge(id: 6_918_990)
|
@@ -26,15 +26,15 @@ Droplet id provided. Finding Droplet...Failed to find Droplet: The resource you
|
|
26
26
|
|
27
27
|
it 'shows a droplet with a fuzzy name' do
|
28
28
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
29
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
29
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
30
30
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
31
31
|
|
32
32
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
33
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
33
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
34
34
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
35
35
|
|
36
36
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
37
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
37
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
38
38
|
to_return(status: 200, body: fixture('show_droplet'), headers: {})
|
39
39
|
|
40
40
|
cli.info('example.com')
|
@@ -56,11 +56,11 @@ Backups Active: false
|
|
56
56
|
|
57
57
|
it 'shows a droplet made from a user image' do
|
58
58
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
59
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
59
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
60
60
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
61
61
|
|
62
62
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
63
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
63
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
64
64
|
to_return(status: 200, body: fixture('show_droplet_user_image'), headers: {})
|
65
65
|
|
66
66
|
cli.options = cli.options.merge(id: 6_918_990)
|
@@ -83,11 +83,11 @@ Backups Active: false
|
|
83
83
|
|
84
84
|
it 'shows a droplet with an id' do
|
85
85
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
86
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
86
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
87
87
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
88
88
|
|
89
89
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
90
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
90
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
91
91
|
to_return(status: 200, body: fixture('show_droplet'), headers: {})
|
92
92
|
|
93
93
|
cli.options = cli.options.merge(id: 6_918_990)
|
@@ -110,15 +110,15 @@ Backups Active: false
|
|
110
110
|
|
111
111
|
it 'shows a droplet with a name' do
|
112
112
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
113
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
113
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
114
114
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
115
115
|
|
116
116
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
117
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
117
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
118
118
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
119
119
|
|
120
120
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
121
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
121
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
122
122
|
to_return(status: 200, body: fixture('show_droplet'), headers: {})
|
123
123
|
|
124
124
|
cli.options = cli.options.merge(name: 'example.com')
|
@@ -141,18 +141,18 @@ Backups Active: false
|
|
141
141
|
|
142
142
|
it 'allows choice of multiple droplets' do
|
143
143
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
144
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
144
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
145
145
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
146
146
|
|
147
147
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
148
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
148
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
149
149
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
150
150
|
|
151
151
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
152
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
152
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
153
153
|
to_return(status: 200, body: fixture('show_droplet'), headers: {})
|
154
154
|
|
155
|
-
$stdin.
|
155
|
+
expect($stdin).to receive(:gets).and_return('0')
|
156
156
|
|
157
157
|
cli.info('examp')
|
158
158
|
|
@@ -179,11 +179,11 @@ Backups Active: false
|
|
179
179
|
|
180
180
|
it 'shows a droplet with an id under porcelain mode' do
|
181
181
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
182
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
182
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
183
183
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
184
184
|
|
185
185
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
186
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
186
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
187
187
|
to_return(status: 200, body: fixture('show_droplet'), headers: {})
|
188
188
|
|
189
189
|
cli.options = cli.options.merge(id: '6918990', porcelain: true)
|
@@ -204,15 +204,15 @@ backups_active false
|
|
204
204
|
|
205
205
|
it 'shows a droplet with a name under porcelain mode' do
|
206
206
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
207
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
207
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
208
208
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
209
209
|
|
210
210
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
211
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
211
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
212
212
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
213
213
|
|
214
214
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
215
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
215
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
216
216
|
to_return(status: 200, body: fixture('show_droplet'), headers: {})
|
217
217
|
|
218
218
|
cli.options = cli.options.merge(name: 'example.com', porcelain: true)
|
@@ -233,11 +233,11 @@ backups_active false
|
|
233
233
|
|
234
234
|
it 'shows a droplet attribute with an id' do
|
235
235
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
236
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
236
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
237
237
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
238
238
|
|
239
239
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
240
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
240
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
241
241
|
to_return(status: 200, body: fixture('show_droplet'), headers: {})
|
242
242
|
|
243
243
|
cli.options = cli.options.merge(id: '6918990', attribute: 'ip4')
|
@@ -251,15 +251,15 @@ Droplet id provided. Finding Droplet...done\e[0m, 6918990 (example.com)
|
|
251
251
|
|
252
252
|
it 'shows a droplet attribute with a name' do
|
253
253
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
254
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
254
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
255
255
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
256
256
|
|
257
257
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
258
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
258
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
259
259
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
260
260
|
|
261
261
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
262
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
262
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
263
263
|
to_return(status: 200, body: fixture('show_droplet'), headers: {})
|
264
264
|
|
265
265
|
cli.options = cli.options.merge(name: 'example.com', attribute: 'ip4')
|
@@ -273,11 +273,11 @@ Droplet name provided. Finding droplet ID...done\e[0m, 6918990 (example.com)
|
|
273
273
|
|
274
274
|
it 'gives error if invalid attribute given' do
|
275
275
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
276
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
276
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
277
277
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
278
278
|
|
279
279
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
280
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
280
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
281
281
|
to_return(status: 200, body: fixture('show_droplet'), headers: {})
|
282
282
|
|
283
283
|
cli.options = cli.options.merge(id: 6_918_990, porcelain: true, attribute: 'foo')
|
@@ -301,7 +301,7 @@ Provide one of the following:
|
|
301
301
|
|
302
302
|
it 'shows a droplet attribute with an id under porcelain mode' do
|
303
303
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
304
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
304
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
305
305
|
to_return(status: 200, body: fixture('show_droplet'), headers: {})
|
306
306
|
|
307
307
|
cli.options = cli.options.merge(id: '6918990', porcelain: true, attribute: 'ip4')
|
@@ -314,15 +314,15 @@ Provide one of the following:
|
|
314
314
|
|
315
315
|
it 'shows a droplet attribute with a name under porcelain mode' do
|
316
316
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
317
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
317
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
318
318
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
319
319
|
|
320
320
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
321
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
321
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
322
322
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
323
323
|
|
324
324
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
325
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
325
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
326
326
|
to_return(status: 200, body: fixture('show_droplet'), headers: {})
|
327
327
|
|
328
328
|
cli.options = cli.options.merge(name: 'example.com', porcelain: true, attribute: 'ip4')
|
@@ -6,11 +6,11 @@ describe Tugboat::CLI do
|
|
6
6
|
describe 'info_image' do
|
7
7
|
it 'shows an image with a fuzzy name' do
|
8
8
|
stub_request(:get, 'https://api.digitalocean.com/v2/images?per_page=200').
|
9
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
9
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
10
10
|
to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_images'))
|
11
11
|
|
12
12
|
stub_request(:get, 'https://api.digitalocean.com/v2/images/12789325?per_page=200').
|
13
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
13
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
14
14
|
to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_coreos_image'))
|
15
15
|
|
16
16
|
cli.info_image('745.1.0 (alpha)')
|
@@ -28,11 +28,11 @@ Regions: nyc1,sfo1,nyc2,ams2,sgp1,lon1,nyc3,ams3,fra1
|
|
28
28
|
|
29
29
|
it 'shows an image with an id' do
|
30
30
|
stub_request(:get, 'https://api.digitalocean.com/v2/images?per_page=200').
|
31
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
31
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
32
32
|
to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_images'))
|
33
33
|
|
34
34
|
stub_request(:get, 'https://api.digitalocean.com/v2/images/12438838?per_page=200').
|
35
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
35
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
36
36
|
to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_redmine_image'))
|
37
37
|
|
38
38
|
cli.options = cli.options.merge(id: 12_438_838)
|
@@ -51,11 +51,11 @@ Regions: nyc1,ams1,sfo1,nyc2,ams2,sgp1,lon1,nyc3,ams3,fra1
|
|
51
51
|
|
52
52
|
it 'shows an image with a name' do
|
53
53
|
stub_request(:get, 'https://api.digitalocean.com/v2/images?per_page=200').
|
54
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
54
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
55
55
|
to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_images'))
|
56
56
|
|
57
57
|
stub_request(:get, 'https://api.digitalocean.com/v2/images/12438838?per_page=200').
|
58
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
58
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
59
59
|
to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_redmine_image'))
|
60
60
|
|
61
61
|
cli.options = cli.options.merge(name: 'Redmine on 14.04')
|
@@ -74,11 +74,11 @@ Regions: nyc1,ams1,sfo1,nyc2,ams2,sgp1,lon1,nyc3,ams3,fra1
|
|
74
74
|
|
75
75
|
it 'errors if no image with matching id is found' do
|
76
76
|
stub_request(:get, 'https://api.digitalocean.com/v2/images?per_page=200').
|
77
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
77
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
78
78
|
to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_images'))
|
79
79
|
|
80
80
|
stub_request(:get, 'https://api.digitalocean.com/v2/images/123?per_page=200').
|
81
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
81
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
82
82
|
to_return(status: 404, body: fixture('not_found'), headers: {})
|
83
83
|
|
84
84
|
cli.options = cli.options.merge(id: '123')
|
@@ -91,7 +91,7 @@ Image id provided. Finding Image...Failed to find Image: The resource you were a
|
|
91
91
|
|
92
92
|
it 'errors if no image with matching name is found' do
|
93
93
|
stub_request(:get, 'https://api.digitalocean.com/v2/images?per_page=200').
|
94
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
94
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
95
95
|
to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_images'))
|
96
96
|
|
97
97
|
cli.options = cli.options.merge(name: 'foobarbaz')
|
@@ -105,7 +105,7 @@ Unable to find an image named 'foobarbaz'.
|
|
105
105
|
|
106
106
|
it 'errors if no image with matching fuzzy name is found' do
|
107
107
|
stub_request(:get, 'https://api.digitalocean.com/v2/images?per_page=200').
|
108
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
108
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
109
109
|
to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_images'))
|
110
110
|
|
111
111
|
expect { cli.info_image('foobarbaz') }.to raise_error(SystemExit)
|
@@ -118,14 +118,14 @@ Unable to find an image named 'foobarbaz'.
|
|
118
118
|
|
119
119
|
it 'allows choice of multiple images' do
|
120
120
|
stub_request(:get, 'https://api.digitalocean.com/v2/images?per_page=200').
|
121
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
121
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
122
122
|
to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_images'))
|
123
123
|
|
124
124
|
stub_request(:get, 'https://api.digitalocean.com/v2/images/9801951?per_page=200').
|
125
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
125
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
126
126
|
to_return(status: 200, body: fixture('ubuntu_image_9801951'), headers: {})
|
127
127
|
|
128
|
-
$stdin.
|
128
|
+
expect($stdin).to receive(:gets).and_return('0')
|
129
129
|
|
130
130
|
cli.info_image('ubun')
|
131
131
|
|