tugboat 1.3.1 → 2.0.0.RC1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +12 -8
- data/lib/tugboat/cli.rb +8 -7
- data/lib/tugboat/config.rb +8 -12
- data/lib/tugboat/middleware/add_key.rb +9 -6
- data/lib/tugboat/middleware/ask_for_credentials.rb +7 -8
- data/lib/tugboat/middleware/check_configuration.rb +1 -1
- data/lib/tugboat/middleware/check_credentials.rb +4 -2
- data/lib/tugboat/middleware/config.rb +3 -4
- data/lib/tugboat/middleware/create_droplet.rb +32 -26
- data/lib/tugboat/middleware/destroy_droplet.rb +6 -6
- data/lib/tugboat/middleware/destroy_image.rb +6 -6
- data/lib/tugboat/middleware/find_droplet.rb +20 -16
- data/lib/tugboat/middleware/find_image.rb +17 -10
- data/lib/tugboat/middleware/halt_droplet.rb +8 -8
- data/lib/tugboat/middleware/info_droplet.rb +38 -25
- data/lib/tugboat/middleware/info_image.rb +5 -5
- data/lib/tugboat/middleware/inject_client.rb +3 -9
- data/lib/tugboat/middleware/list_droplets.rb +6 -4
- data/lib/tugboat/middleware/list_images.rb +28 -23
- data/lib/tugboat/middleware/list_regions.rb +3 -3
- data/lib/tugboat/middleware/list_sizes.rb +3 -3
- data/lib/tugboat/middleware/list_ssh_keys.rb +5 -4
- data/lib/tugboat/middleware/password_reset.rb +7 -7
- data/lib/tugboat/middleware/rebuild_droplet.rb +8 -8
- data/lib/tugboat/middleware/resize_droplet.rb +7 -7
- data/lib/tugboat/middleware/restart_droplet.rb +8 -8
- data/lib/tugboat/middleware/snapshot_droplet.rb +6 -6
- data/lib/tugboat/middleware/ssh_droplet.rb +3 -1
- data/lib/tugboat/middleware/start_droplet.rb +6 -6
- data/lib/tugboat/middleware/wait_for_state.rb +6 -6
- data/lib/tugboat/version.rb +1 -1
- data/spec/cli/add_key_spec.rb +16 -9
- data/spec/cli/authorize_cli_spec.rb +24 -29
- data/spec/cli/config_cli_spec.rb +57 -0
- data/spec/cli/create_cli_spec.rb +18 -28
- data/spec/cli/debug_cli_spec.rb +8 -14
- data/spec/cli/destroy_cli_spec.rb +39 -50
- data/spec/cli/destroy_image_cli_spec.rb +33 -39
- data/spec/cli/droplets_cli_spec.rb +15 -12
- data/spec/cli/halt_cli_spec.rb +50 -46
- data/spec/cli/images_cli_spec.rb +134 -58
- data/spec/cli/info_cli_spec.rb +139 -139
- data/spec/cli/info_image_cli_spec.rb +113 -26
- data/spec/cli/keys_cli_spec.rb +7 -5
- data/spec/cli/password_reset_cli_spec.rb +46 -44
- data/spec/cli/rebuild_cli_spec.rb +187 -101
- data/spec/cli/regions_cli_spec.rb +13 -6
- data/spec/cli/resize_cli_spec.rb +51 -48
- data/spec/cli/restart_cli_spec.rb +41 -39
- data/spec/cli/sizes_cli_spec.rb +13 -8
- data/spec/cli/snapshot_cli_spec.rb +36 -37
- data/spec/cli/ssh_cli_spec.rb +7 -15
- data/spec/cli/start_cli_spec.rb +39 -35
- data/spec/cli/verify_cli_spec.rb +20 -12
- data/spec/cli/wait_cli_spec.rb +43 -27
- data/spec/config_spec.rb +19 -25
- data/spec/fixtures/create_droplet.json +44 -0
- data/spec/fixtures/create_ssh_key.json +4 -4
- data/spec/fixtures/create_ssh_key_from_file.json +8 -0
- data/spec/fixtures/droplet_start_response.json +13 -0
- data/spec/fixtures/not_found.json +4 -0
- data/spec/fixtures/password_reset_response.json +13 -0
- data/spec/fixtures/power_cycle_response.json +13 -0
- data/spec/fixtures/resize_droplet.json +13 -0
- data/spec/fixtures/restart_response.json +13 -0
- data/spec/fixtures/show_coreos_image.json +23 -0
- data/spec/fixtures/show_droplet.json +90 -11
- data/spec/fixtures/show_droplet_inactive.json +90 -11
- data/spec/fixtures/show_droplets.json +249 -30
- data/spec/fixtures/show_droplets_empty.json +5 -2
- data/spec/fixtures/show_image.json +14 -7
- data/spec/fixtures/show_images.json +1075 -13
- data/spec/fixtures/show_images_global.json +25 -16
- data/spec/fixtures/show_keys.json +15 -7
- data/spec/fixtures/show_redmine_image.json +24 -0
- data/spec/fixtures/show_regions.json +181 -12
- data/spec/fixtures/show_sizes.json +178 -9
- data/spec/fixtures/shutdown_response.json +13 -0
- data/spec/fixtures/snapshot_response.json +13 -0
- data/spec/fixtures/ubuntu_image_9801951.json +24 -0
- data/spec/middleware/check_credentials_spec.rb +4 -3
- data/spec/middleware/inject_client_spec.rb +2 -2
- data/spec/shared/environment.rb +6 -7
- data/spec/spec_helper.rb +1 -1
- data/tugboat.gemspec +39 -19
- metadata +50 -14
- data/spec/fixtures/show_droplet_fuzzy.json +0 -13
- data/spec/fixtures/show_droplets_fuzzy.json +0 -35
- data/spec/fixtures/show_droplets_inactive.json +0 -37
@@ -5,23 +5,25 @@ describe Tugboat::CLI do
|
|
5
5
|
|
6
6
|
describe "droplets" do
|
7
7
|
it "shows a list when droplets exist" do
|
8
|
-
stub_request(:get, "https://api.digitalocean.com/droplets?
|
9
|
-
|
8
|
+
stub_request(:get, "https://api.digitalocean.com/v2/droplets?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.2'}).
|
10
|
+
to_return(:status => 200, :body => fixture("show_droplets"), :headers => {'Content-Type' => 'application/json'},)
|
10
11
|
|
11
12
|
@cli.droplets
|
12
13
|
|
13
14
|
expect($stdout.string).to eq <<-eos
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
example.com (ip: 104.236.32.182, status: \e[32mactive\e[0m, region: nyc3, id: 6918990)
|
16
|
+
example2.com (ip: 104.236.32.172, status: \e[32mactive\e[0m, region: nyc3, id: 3164956)
|
17
|
+
example3.com (ip: 104.236.32.173, status: \e[31moff\e[0m, region: nyc3, id: 3164444)
|
17
18
|
eos
|
18
19
|
|
19
|
-
expect(a_request(:get, "https://api.digitalocean.com/droplets?
|
20
|
+
expect(a_request(:get, "https://api.digitalocean.com/v2/droplets?per_page=200")).to have_been_made
|
20
21
|
end
|
21
22
|
|
22
23
|
it "returns an error message when no droplets exist" do
|
23
|
-
stub_request(:get, "https://api.digitalocean.com/droplets?
|
24
|
-
|
24
|
+
stub_request(:get, "https://api.digitalocean.com/v2/droplets?per_page=200").
|
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
|
+
to_return(:status => 200, :body => fixture("show_droplets_empty"), :headers => {'Content-Type' => 'application/json'},)
|
25
27
|
|
26
28
|
@cli.droplets
|
27
29
|
|
@@ -30,11 +32,12 @@ You don't appear to have any droplets.
|
|
30
32
|
Try creating one with \e[32m`tugboat create`\e[0m
|
31
33
|
eos
|
32
34
|
|
33
|
-
expect(a_request(:get, "https://api.digitalocean.com/droplets?
|
35
|
+
expect(a_request(:get, "https://api.digitalocean.com/v2/droplets?per_page=200")).to have_been_made
|
34
36
|
end
|
35
37
|
it "shows no output when --quiet is set" do
|
36
|
-
stub_request(:get, "https://api.digitalocean.com/droplets?
|
37
|
-
|
38
|
+
stub_request(:get, "https://api.digitalocean.com/v2/droplets?per_page=200").
|
39
|
+
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'}).
|
40
|
+
to_return(:status => 200, :body => fixture("show_droplets"), :headers => {'Content-Type' => 'application/json'},)
|
38
41
|
|
39
42
|
@cli.options = @cli.options.merge(:quiet => true)
|
40
43
|
@cli.droplets
|
@@ -42,7 +45,7 @@ Try creating one with \e[32m`tugboat create`\e[0m
|
|
42
45
|
# Should be /dev/null not stringIO
|
43
46
|
expect($stdout).to be_a File
|
44
47
|
|
45
|
-
expect(a_request(:get, "https://api.digitalocean.com/droplets?
|
48
|
+
expect(a_request(:get, "https://api.digitalocean.com/v2/droplets?per_page=200")).to have_been_made
|
46
49
|
end
|
47
50
|
end
|
48
51
|
|
data/spec/cli/halt_cli_spec.rb
CHANGED
@@ -5,94 +5,98 @@ describe Tugboat::CLI do
|
|
5
5
|
|
6
6
|
describe "halt" do
|
7
7
|
it "halts a droplet with a fuzzy name" do
|
8
|
-
stub_request(:get, "https://api.digitalocean.com/droplets?
|
9
|
-
|
8
|
+
stub_request(:get, "https://api.digitalocean.com/v2/droplets?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.2'}).
|
10
|
+
to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
|
10
11
|
|
11
|
-
stub_request(:
|
12
|
-
|
12
|
+
stub_request(:post, "https://api.digitalocean.com/v2/droplets/6918990/actions").
|
13
|
+
with(:body => "{\"type\":\"shutdown\"}",
|
14
|
+
: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'}).
|
15
|
+
to_return(:status => 200, :body => fixture('shutdown_response'), :headers => {})
|
13
16
|
|
14
|
-
@cli.halt("
|
17
|
+
@cli.halt("example.com")
|
15
18
|
|
16
19
|
expect($stdout.string).to eq <<-eos
|
17
|
-
Droplet fuzzy name provided. Finding droplet ID...done\e[0m,
|
18
|
-
Queuing shutdown for
|
20
|
+
Droplet fuzzy name provided. Finding droplet ID...done\e[0m, 6918990 (example.com)
|
21
|
+
Queuing shutdown for 6918990 (example.com)...Halt successful!
|
19
22
|
eos
|
20
|
-
|
21
|
-
expect(a_request(:get, "https://api.digitalocean.com/droplets?api_key=#{api_key}&client_id=#{client_key}")).to have_been_made
|
22
|
-
expect(a_request(:put, "https://api.digitalocean.com/droplets/100823/shutdown?api_key=#{api_key}&client_id=#{client_key}")).to have_been_made
|
23
23
|
end
|
24
24
|
|
25
25
|
it "halts a droplet hard when the hard option is used" do
|
26
|
-
stub_request(:get, "https://api.digitalocean.com/droplets?
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
stub_request(:get, "https://api.digitalocean.com/v2/droplets?per_page=200").
|
27
|
+
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'}).
|
28
|
+
to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
|
29
|
+
|
30
|
+
stub_request(:post, "https://api.digitalocean.com/v2/droplets/6918990/actions").
|
31
|
+
with(:body => "{\"type\":\"power_off\"}",
|
32
|
+
: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'}).
|
33
|
+
to_return(:status => 200, :body => "", :headers => {})
|
30
34
|
|
31
35
|
@cli.options = @cli.options.merge(:hard => true)
|
32
|
-
@cli.halt("
|
36
|
+
@cli.halt("example.com")
|
33
37
|
|
34
38
|
expect($stdout.string).to eq <<-eos
|
35
|
-
Droplet fuzzy name provided. Finding droplet ID...done\e[0m,
|
36
|
-
Queuing hard shutdown for
|
39
|
+
Droplet fuzzy name provided. Finding droplet ID...done\e[0m, 6918990 (example.com)
|
40
|
+
Queuing hard shutdown for 6918990 (example.com)...Halt successful!
|
37
41
|
eos
|
38
|
-
|
39
|
-
expect(a_request(:get, "https://api.digitalocean.com/droplets?api_key=#{api_key}&client_id=#{client_key}")).to have_been_made
|
40
|
-
expect(a_request(:put, "https://api.digitalocean.com/droplets/100823/power_off?api_key=#{api_key}&client_id=#{client_key}")).to have_been_made
|
41
42
|
end
|
42
43
|
|
43
44
|
it "halts a droplet with an id" do
|
44
|
-
stub_request(:get, "https://api.digitalocean.com/droplets
|
45
|
-
|
45
|
+
stub_request(:get, "https://api.digitalocean.com/v2/droplets/?per_page=200").
|
46
|
+
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'}).
|
47
|
+
to_return(:status => 200, :body => fixture("show_droplets"), :headers => {'Content-Type' => 'application/json'},)
|
48
|
+
|
49
|
+
stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
|
50
|
+
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'}).
|
51
|
+
to_return(:status => 200, :body => fixture('show_droplet'), :headers => {})
|
46
52
|
|
47
|
-
stub_request(:
|
48
|
-
|
53
|
+
stub_request(:post, "https://api.digitalocean.com/v2/droplets/6918990/actions").
|
54
|
+
with(:body => "{\"type\":\"shutdown\"}",
|
55
|
+
: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'}).
|
56
|
+
to_return(:status => 200, :body => fixture('shutdown_response'), :headers => {})
|
49
57
|
|
50
|
-
@cli.options = @cli.options.merge(:id =>
|
58
|
+
@cli.options = @cli.options.merge(:id => '6918990')
|
51
59
|
@cli.halt
|
52
60
|
|
53
61
|
expect($stdout.string).to eq <<-eos
|
54
|
-
Droplet id provided. Finding Droplet...done\e[0m,
|
55
|
-
Queuing shutdown for
|
62
|
+
Droplet id provided. Finding Droplet...done\e[0m, 6918990 (example.com)
|
63
|
+
Queuing shutdown for 6918990 (example.com)...Halt successful!
|
56
64
|
eos
|
57
|
-
|
58
|
-
expect(a_request(:get, "https://api.digitalocean.com/droplets/#{droplet_id}?api_key=#{api_key}&client_id=#{client_key}")).to have_been_made
|
59
|
-
expect(a_request(:put, "https://api.digitalocean.com/droplets/100823/shutdown?api_key=#{api_key}&client_id=#{client_key}")).to have_been_made
|
60
65
|
end
|
61
66
|
|
62
67
|
|
63
68
|
it "halts a droplet with a name" do
|
64
|
-
stub_request(:get, "https://api.digitalocean.com/droplets?
|
65
|
-
|
69
|
+
stub_request(:get, "https://api.digitalocean.com/v2/droplets?per_page=200").
|
70
|
+
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'}).
|
71
|
+
to_return(:status => 200, :body => fixture("show_droplets"), :headers => {'Content-Type' => 'application/json'},)
|
66
72
|
|
67
|
-
stub_request(:
|
68
|
-
|
73
|
+
stub_request(:post, "https://api.digitalocean.com/v2/droplets/6918990/actions").
|
74
|
+
with(:body => "{\"type\":\"shutdown\"}",
|
75
|
+
: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'}).
|
76
|
+
to_return(:status => 200, :body => fixture('shutdown_response'), :headers => {})
|
69
77
|
|
70
|
-
@cli.options = @cli.options.merge(:name =>
|
78
|
+
@cli.options = @cli.options.merge(:name => 'example.com')
|
71
79
|
@cli.halt
|
72
80
|
|
73
81
|
expect($stdout.string).to eq <<-eos
|
74
|
-
Droplet name provided. Finding droplet ID...done\e[0m,
|
75
|
-
Queuing shutdown for
|
82
|
+
Droplet name provided. Finding droplet ID...done\e[0m, 6918990 (example.com)
|
83
|
+
Queuing shutdown for 6918990 (example.com)...Halt successful!
|
76
84
|
eos
|
77
|
-
|
78
|
-
expect(a_request(:get, "https://api.digitalocean.com/droplets?api_key=#{api_key}&client_id=#{client_key}")).to have_been_made
|
79
|
-
expect(a_request(:put, "https://api.digitalocean.com/droplets/100823/shutdown?api_key=#{api_key}&client_id=#{client_key}")).to have_been_made
|
80
85
|
end
|
81
86
|
|
82
87
|
|
83
88
|
it "does not halt a droplet that is off" do
|
84
|
-
stub_request(:get, "https://api.digitalocean.com/droplets?
|
85
|
-
|
89
|
+
stub_request(:get, "https://api.digitalocean.com/v2/droplets?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.9.2'}).
|
91
|
+
to_return(:status => 200, :body => fixture("show_droplets"), :headers => {'Content-Type' => 'application/json'},)
|
86
92
|
|
87
|
-
@cli.options = @cli.options.merge(:name =>
|
93
|
+
@cli.options = @cli.options.merge(:name => 'example3.com')
|
88
94
|
expect {@cli.halt}.to raise_error(SystemExit)
|
89
95
|
|
90
96
|
expect($stdout.string).to eq <<-eos
|
91
|
-
Droplet name provided. Finding droplet ID...done\e[0m,
|
97
|
+
Droplet name provided. Finding droplet ID...done\e[0m, 3164444 (example3.com)
|
92
98
|
Droplet must be on for this operation to be successful.
|
93
99
|
eos
|
94
|
-
|
95
|
-
expect(a_request(:get, "https://api.digitalocean.com/droplets?api_key=#{api_key}&client_id=#{client_key}")).to have_been_made
|
96
100
|
end
|
97
101
|
|
98
102
|
end
|
data/spec/cli/images_cli_spec.rb
CHANGED
@@ -4,86 +4,162 @@ describe Tugboat::CLI do
|
|
4
4
|
include_context "spec"
|
5
5
|
|
6
6
|
describe "images" do
|
7
|
-
it "shows
|
8
|
-
stub_request(:get, "https://api.digitalocean.com/images?
|
9
|
-
|
7
|
+
it "shows all images by default" do
|
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.2'}).
|
10
|
+
to_return(:status => 200, :body => fixture('show_images'), :headers => {})
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
Listing Your Images
|
15
|
-
(Use `tugboat images --global` to show all images)
|
16
|
-
My Images:
|
17
|
-
NYTD Backup 1-18-2012 (id: 466, distro: Ubuntu)
|
18
|
-
NLP Final (id: 478, distro: Ubuntu)
|
19
|
-
eos
|
20
|
-
|
21
|
-
expect(a_request(:get, "https://api.digitalocean.com/images?api_key=#{api_key}&client_id=#{client_key}&filter=my_images")).to have_been_made
|
22
|
-
end
|
23
|
-
|
24
|
-
it "acknowledges when my images are empty" do
|
25
|
-
stub_request(:get, "https://api.digitalocean.com/images?api_key=#{api_key}&client_id=#{client_key}&filter=my_images").
|
26
|
-
to_return(:headers => {'Content-Type' => 'application/json'}, :status => 200, :body => fixture("show_images_empty"))
|
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.9.2'}).
|
14
|
+
to_return(:status => 200, :body => fixture('show_images_global'), :headers => {})
|
27
15
|
|
28
16
|
@cli.images
|
29
17
|
|
30
18
|
expect($stdout.string).to eq <<-eos
|
31
|
-
|
32
|
-
|
33
|
-
My
|
34
|
-
|
19
|
+
Showing both private and public images
|
20
|
+
Private Images:
|
21
|
+
My application image (id: 6376601, distro: Ubuntu)
|
22
|
+
|
23
|
+
Public Images:
|
24
|
+
745.1.0 (alpha) (slug: coreos-alpha, id: 12789325, distro: CoreOS)
|
25
|
+
723.3.0 (beta) (slug: coreos-beta, id: 12789350, distro: CoreOS)
|
26
|
+
717.3.0 (stable) (slug: coreos-stable, id: 12789351, distro: CoreOS)
|
27
|
+
5.10 x64 (slug: centos-5-8-x64, id: 6372321, distro: CentOS)
|
28
|
+
5.10 x32 (slug: centos-5-8-x32, id: 6372425, distro: CentOS)
|
29
|
+
6.0 x64 (slug: debian-6-0-x64, id: 6372581, distro: Debian)
|
30
|
+
6.0 x32 (slug: debian-6-0-x32, id: 6372662, distro: Debian)
|
31
|
+
21 x64 (slug: fedora-21-x64, id: 9640922, distro: Fedora)
|
32
|
+
14.10 x32 (slug: ubuntu-14-10-x32, id: 9801951, distro: Ubuntu)
|
33
|
+
14.10 x64 (slug: ubuntu-14-10-x64, id: 9801954, distro: Ubuntu)
|
34
|
+
10.1 (slug: freebsd-10-1-x64, id: 10144573, distro: FreeBSD)
|
35
|
+
12.04.5 x64 (slug: ubuntu-12-04-x64, id: 10321756, distro: Ubuntu)
|
36
|
+
12.04.5 x32 (slug: ubuntu-12-04-x32, id: 10321777, distro: Ubuntu)
|
37
|
+
7.0 x64 (slug: debian-7-0-x64, id: 10322059, distro: Debian)
|
38
|
+
7.0 x32 (slug: debian-7-0-x32, id: 10322378, distro: Debian)
|
39
|
+
7 x64 (slug: centos-7-0-x64, id: 10322623, distro: CentOS)
|
40
|
+
6.5 x32 (slug: centos-6-5-x32, id: 11523060, distro: CentOS)
|
41
|
+
6.5 x64 (slug: centos-6-5-x64, id: 11523085, distro: CentOS)
|
42
|
+
22 x64 (slug: fedora-22-x64, id: 12065782, distro: Fedora)
|
43
|
+
15.04 x64 (slug: ubuntu-15-04-x64, id: 12658446, distro: Ubuntu)
|
44
|
+
15.04 x32 (slug: ubuntu-15-04-x32, id: 12660649, distro: Ubuntu)
|
45
|
+
8.1 x64 (slug: debian-8-x64, id: 12778278, distro: Debian)
|
46
|
+
8.1 x32 (slug: debian-8-x32, id: 12778337, distro: Debian)
|
47
|
+
14.04 x32 (slug: ubuntu-14-04-x32, id: 12790298, distro: Ubuntu)
|
48
|
+
14.04 x64 (slug: ubuntu-14-04-x64, id: 12790328, distro: Ubuntu)
|
49
|
+
FreeBSD AMP on 10.1 (slug: freebsd-amp, id: 10163059, distro: FreeBSD)
|
50
|
+
Mumble Server (murmur) on 14.04 (slug: mumble, id: 11132249, distro: Ubuntu)
|
51
|
+
LAMP on 14.04 (slug: lamp, id: 11146541, distro: Ubuntu)
|
52
|
+
LEMP on 14.04 (slug: lemp, id: 11146558, distro: Ubuntu)
|
53
|
+
MEAN on 14.04 (slug: mean, id: 11146864, distro: Ubuntu)
|
54
|
+
Joomla! 3.4.1 on 14.04 (slug: joomla, id: 11163798, distro: Ubuntu)
|
55
|
+
Drone on 14.04 (slug: drone, id: 11774848, distro: Ubuntu)
|
56
|
+
Magento 1.9.1.1 on 14.04 (slug: magento, id: 11876697, distro: Ubuntu)
|
57
|
+
Ghost 0.6.4 on 14.04 (slug: ghost, id: 12035275, distro: Ubuntu)
|
58
|
+
Ruby on Rails on 14.04 (Postgres, Nginx, Unicorn) (slug: ruby-on-rails, id: 12035706, distro: Ubuntu)
|
59
|
+
ownCloud 8.0.4 on 14.04 (slug: owncloud, id: 12333784, distro: Ubuntu)
|
60
|
+
Drupal 7.38 on 14.04 (slug: drupal, id: 12394820, distro: Ubuntu)
|
61
|
+
Dokku v0.3.19 on 14.04 (slug: dokku, id: 12466201, distro: Ubuntu)
|
62
|
+
MongoDB 3.0.4 on 14.04 (slug: mongodb, id: 12467027, distro: Ubuntu)
|
63
|
+
node-v0.12.5 on 14.04 (slug: node, id: 12467797, distro: Ubuntu)
|
64
|
+
Cassandra on 14.04 (slug: cassandra, id: 12540744, distro: Ubuntu)
|
65
|
+
ELK Logging Stack on 14.04 (slug: elk, id: 12542038, distro: Ubuntu)
|
66
|
+
GitLab 7.12.2 CE on 14.04 (slug: gitlab, id: 12702571, distro: Ubuntu)
|
67
|
+
WordPress on 14.04 (slug: wordpress, id: 12740613, distro: Ubuntu)
|
68
|
+
Django on 14.04 (slug: django, id: 12740667, distro: Ubuntu)
|
69
|
+
Docker 1.7.1 on 14.04 (slug: docker, id: 12764973, distro: Ubuntu)
|
70
|
+
MediaWiki 1.24.2 on 14.04 (slug: mediawiki, id: 11716043, distro: Ubuntu)
|
71
|
+
PHPMyAdmin on 14.04 (slug: phpmyadmin, id: 11730661, distro: Ubuntu)
|
72
|
+
Redmine on 14.04 (slug: redmine, id: 12438838, distro: Ubuntu)
|
35
73
|
eos
|
36
|
-
|
37
|
-
expect(a_request(:get, "https://api.digitalocean.com/images?api_key=#{api_key}&client_id=#{client_key}&filter=my_images")).to have_been_made
|
38
74
|
end
|
39
75
|
|
40
|
-
it "acknowledges when
|
41
|
-
stub_request(:get, "https://api.digitalocean.com/images?
|
42
|
-
|
76
|
+
it "acknowledges when personal images are empty when showing default full list" do
|
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.9.2'}).
|
79
|
+
to_return(:status => 200, :body => fixture('show_images'), :headers => {})
|
43
80
|
|
44
|
-
stub_request(:get, "https://api.digitalocean.com/images?
|
45
|
-
|
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.9.2'}).
|
83
|
+
to_return(:status => 200, :body => fixture('show_images_empty'), :headers => {})
|
46
84
|
|
47
|
-
@cli.options = @cli.options.merge(:
|
85
|
+
@cli.options = @cli.options.merge(:show_private_images => true)
|
48
86
|
@cli.images
|
49
87
|
|
50
88
|
expect($stdout.string).to eq <<-eos
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
89
|
+
Showing both private and public images
|
90
|
+
Private Images:
|
91
|
+
No private images found
|
92
|
+
|
93
|
+
Public Images:
|
94
|
+
745.1.0 (alpha) (slug: coreos-alpha, id: 12789325, distro: CoreOS)
|
95
|
+
723.3.0 (beta) (slug: coreos-beta, id: 12789350, distro: CoreOS)
|
96
|
+
717.3.0 (stable) (slug: coreos-stable, id: 12789351, distro: CoreOS)
|
97
|
+
5.10 x64 (slug: centos-5-8-x64, id: 6372321, distro: CentOS)
|
98
|
+
5.10 x32 (slug: centos-5-8-x32, id: 6372425, distro: CentOS)
|
99
|
+
6.0 x64 (slug: debian-6-0-x64, id: 6372581, distro: Debian)
|
100
|
+
6.0 x32 (slug: debian-6-0-x32, id: 6372662, distro: Debian)
|
101
|
+
21 x64 (slug: fedora-21-x64, id: 9640922, distro: Fedora)
|
102
|
+
14.10 x32 (slug: ubuntu-14-10-x32, id: 9801951, distro: Ubuntu)
|
103
|
+
14.10 x64 (slug: ubuntu-14-10-x64, id: 9801954, distro: Ubuntu)
|
104
|
+
10.1 (slug: freebsd-10-1-x64, id: 10144573, distro: FreeBSD)
|
105
|
+
12.04.5 x64 (slug: ubuntu-12-04-x64, id: 10321756, distro: Ubuntu)
|
106
|
+
12.04.5 x32 (slug: ubuntu-12-04-x32, id: 10321777, distro: Ubuntu)
|
107
|
+
7.0 x64 (slug: debian-7-0-x64, id: 10322059, distro: Debian)
|
108
|
+
7.0 x32 (slug: debian-7-0-x32, id: 10322378, distro: Debian)
|
109
|
+
7 x64 (slug: centos-7-0-x64, id: 10322623, distro: CentOS)
|
110
|
+
6.5 x32 (slug: centos-6-5-x32, id: 11523060, distro: CentOS)
|
111
|
+
6.5 x64 (slug: centos-6-5-x64, id: 11523085, distro: CentOS)
|
112
|
+
22 x64 (slug: fedora-22-x64, id: 12065782, distro: Fedora)
|
113
|
+
15.04 x64 (slug: ubuntu-15-04-x64, id: 12658446, distro: Ubuntu)
|
114
|
+
15.04 x32 (slug: ubuntu-15-04-x32, id: 12660649, distro: Ubuntu)
|
115
|
+
8.1 x64 (slug: debian-8-x64, id: 12778278, distro: Debian)
|
116
|
+
8.1 x32 (slug: debian-8-x32, id: 12778337, distro: Debian)
|
117
|
+
14.04 x32 (slug: ubuntu-14-04-x32, id: 12790298, distro: Ubuntu)
|
118
|
+
14.04 x64 (slug: ubuntu-14-04-x64, id: 12790328, distro: Ubuntu)
|
119
|
+
FreeBSD AMP on 10.1 (slug: freebsd-amp, id: 10163059, distro: FreeBSD)
|
120
|
+
Mumble Server (murmur) on 14.04 (slug: mumble, id: 11132249, distro: Ubuntu)
|
121
|
+
LAMP on 14.04 (slug: lamp, id: 11146541, distro: Ubuntu)
|
122
|
+
LEMP on 14.04 (slug: lemp, id: 11146558, distro: Ubuntu)
|
123
|
+
MEAN on 14.04 (slug: mean, id: 11146864, distro: Ubuntu)
|
124
|
+
Joomla! 3.4.1 on 14.04 (slug: joomla, id: 11163798, distro: Ubuntu)
|
125
|
+
Drone on 14.04 (slug: drone, id: 11774848, distro: Ubuntu)
|
126
|
+
Magento 1.9.1.1 on 14.04 (slug: magento, id: 11876697, distro: Ubuntu)
|
127
|
+
Ghost 0.6.4 on 14.04 (slug: ghost, id: 12035275, distro: Ubuntu)
|
128
|
+
Ruby on Rails on 14.04 (Postgres, Nginx, Unicorn) (slug: ruby-on-rails, id: 12035706, distro: Ubuntu)
|
129
|
+
ownCloud 8.0.4 on 14.04 (slug: owncloud, id: 12333784, distro: Ubuntu)
|
130
|
+
Drupal 7.38 on 14.04 (slug: drupal, id: 12394820, distro: Ubuntu)
|
131
|
+
Dokku v0.3.19 on 14.04 (slug: dokku, id: 12466201, distro: Ubuntu)
|
132
|
+
MongoDB 3.0.4 on 14.04 (slug: mongodb, id: 12467027, distro: Ubuntu)
|
133
|
+
node-v0.12.5 on 14.04 (slug: node, id: 12467797, distro: Ubuntu)
|
134
|
+
Cassandra on 14.04 (slug: cassandra, id: 12540744, distro: Ubuntu)
|
135
|
+
ELK Logging Stack on 14.04 (slug: elk, id: 12542038, distro: Ubuntu)
|
136
|
+
GitLab 7.12.2 CE on 14.04 (slug: gitlab, id: 12702571, distro: Ubuntu)
|
137
|
+
WordPress on 14.04 (slug: wordpress, id: 12740613, distro: Ubuntu)
|
138
|
+
Django on 14.04 (slug: django, id: 12740667, distro: Ubuntu)
|
139
|
+
Docker 1.7.1 on 14.04 (slug: docker, id: 12764973, distro: Ubuntu)
|
140
|
+
MediaWiki 1.24.2 on 14.04 (slug: mediawiki, id: 11716043, distro: Ubuntu)
|
141
|
+
PHPMyAdmin on 14.04 (slug: phpmyadmin, id: 11730661, distro: Ubuntu)
|
142
|
+
Redmine on 14.04 (slug: redmine, id: 12438838, distro: Ubuntu)
|
58
143
|
eos
|
59
|
-
|
60
|
-
expect(a_request(:get, "https://api.digitalocean.com/images?api_key=#{api_key}&client_id=#{client_key}&filter=my_images")).to have_been_made
|
61
|
-
expect(a_request(:get, "https://api.digitalocean.com/images?api_key=#{api_key}&client_id=#{client_key}&filter=global")).to have_been_made
|
62
144
|
end
|
63
145
|
|
64
|
-
it "
|
65
|
-
stub_request(:get, "https://api.digitalocean.com/images?
|
66
|
-
|
146
|
+
it "acknowledges when personal images are empty when just show private images flag given" do
|
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.9.2'}).
|
149
|
+
to_return(:status => 200, :body => fixture('show_images'), :headers => {})
|
67
150
|
|
68
|
-
stub_request(:get, "https://api.digitalocean.com/images?
|
69
|
-
|
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.9.2'}).
|
153
|
+
to_return(:status => 200, :body => fixture('show_images_empty'), :headers => {})
|
70
154
|
|
71
|
-
@cli.options = @cli.options.merge(:
|
155
|
+
@cli.options = @cli.options.merge(:show_just_private_images => true)
|
72
156
|
@cli.images
|
73
157
|
|
74
158
|
expect($stdout.string).to eq <<-eos
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
Global Images:
|
80
|
-
NYTD Backup 1-18-2012 (id: 466, distro: Ubuntu)
|
81
|
-
NLP Final (id: 478, distro: Ubuntu)
|
82
|
-
Global Final (id: 479, distro: Ubuntu)
|
159
|
+
Showing just private images
|
160
|
+
Private Images:
|
161
|
+
No private images found
|
83
162
|
eos
|
84
|
-
|
85
|
-
expect(a_request(:get, "https://api.digitalocean.com/images?api_key=#{api_key}&client_id=#{client_key}&filter=my_images")).to have_been_made
|
86
|
-
expect(a_request(:get, "https://api.digitalocean.com/images?api_key=#{api_key}&client_id=#{client_key}&filter=global")).to have_been_made
|
87
163
|
end
|
88
164
|
end
|
89
165
|
|