fog-brightbox 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -0
- data/CHANGELOG.md +18 -0
- data/fog-brightbox.gemspec +1 -0
- data/lib/fog/brightbox/compute/shared.rb +1 -1
- data/lib/fog/brightbox/oauth2.rb +16 -13
- data/lib/fog/brightbox/version.rb +1 -1
- data/spec/fog/brightbox/oauth2/client_credentials_strategy_spec.rb +30 -0
- data/spec/fog/brightbox/oauth2/credential_set_spec.rb +86 -0
- data/spec/fog/brightbox/oauth2/grant_type_strategy_spec.rb +24 -0
- data/spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb +33 -0
- data/spec/fog/brightbox/oauth2/user_credentials_strategy_spec.rb +40 -0
- data/spec/fog/compute/brightbox/database_server_spec.rb +3 -3
- data/spec/fog/compute/brightbox/server_spec.rb +3 -3
- data/tests/brightbox/compute/helper.rb +1 -0
- data/tests/brightbox/compute/schema.rb +794 -0
- data/tests/brightbox/compute_tests.rb +98 -0
- data/tests/brightbox/helper.rb +1 -0
- data/tests/brightbox/models/compute/account_tests.rb +15 -0
- data/tests/brightbox/models/compute/cloud_ip_tests.rb +32 -0
- data/tests/brightbox/models/compute/database_server_tests.rb +78 -0
- data/tests/brightbox/models/compute/database_snapshot_tests.rb +26 -0
- data/tests/brightbox/models/compute/database_type_tests.rb +27 -0
- data/tests/brightbox/models/compute/server_tests.rb +19 -0
- data/tests/brightbox/requests/compute/account_tests.rb +59 -0
- data/tests/brightbox/requests/compute/api_client_tests.rb +59 -0
- data/tests/brightbox/requests/compute/application_test.rb +58 -0
- data/tests/brightbox/requests/compute/cloud_ip_tests.rb +79 -0
- data/tests/brightbox/requests/compute/collaboration_tests.rb +36 -0
- data/tests/brightbox/requests/compute/database_server_tests.rb +53 -0
- data/tests/brightbox/requests/compute/database_snapsnot_tests.rb +46 -0
- data/tests/brightbox/requests/compute/database_type_tests.rb +16 -0
- data/tests/brightbox/requests/compute/firewall_policy_tests.rb +39 -0
- data/tests/brightbox/requests/compute/firewall_rule_tests.rb +42 -0
- data/tests/brightbox/requests/compute/helper.rb +42 -0
- data/tests/brightbox/requests/compute/image_tests.rb +54 -0
- data/tests/brightbox/requests/compute/interface_tests.rb +30 -0
- data/tests/brightbox/requests/compute/load_balancer_tests.rb +116 -0
- data/tests/brightbox/requests/compute/server_group_tests.rb +91 -0
- data/tests/brightbox/requests/compute/server_tests.rb +93 -0
- data/tests/brightbox/requests/compute/server_type_tests.rb +28 -0
- data/tests/brightbox/requests/compute/user_collaboration_tests.rb +65 -0
- data/tests/brightbox/requests/compute/user_tests.rb +32 -0
- data/tests/brightbox/requests/compute/zone_tests.rb +28 -0
- data/tests/helper.rb +8 -0
- data/tests/helpers/collection_helper.rb +91 -0
- data/tests/helpers/compute/flavors_helper.rb +28 -0
- data/tests/helpers/compute/server_helper.rb +23 -0
- data/tests/helpers/compute/servers_helper.rb +8 -0
- data/tests/helpers/formats_helper.rb +98 -0
- data/tests/helpers/formats_helper_tests.rb +106 -0
- data/tests/helpers/mock_helper.rb +98 -0
- data/tests/helpers/model_helper.rb +29 -0
- data/tests/helpers/responds_to_helper.rb +11 -0
- data/tests/helpers/schema_validator_tests.rb +101 -0
- data/tests/helpers/succeeds_helper.rb +9 -0
- metadata +68 -2
@@ -0,0 +1,116 @@
|
|
1
|
+
Shindo.tests("Fog::Compute[:brightbox] | load balancer requests", ["brightbox"]) do
|
2
|
+
tests("success") do
|
3
|
+
unless Fog.mocking?
|
4
|
+
@node = Brightbox::Compute::TestSupport.get_test_server
|
5
|
+
node_id = @node.id
|
6
|
+
end
|
7
|
+
|
8
|
+
create_options = {
|
9
|
+
:nodes => [{
|
10
|
+
:node => node_id
|
11
|
+
}],
|
12
|
+
:listeners => [{
|
13
|
+
:in => 80,
|
14
|
+
:out => 8080,
|
15
|
+
:protocol => "http"
|
16
|
+
}],
|
17
|
+
:healthcheck => {
|
18
|
+
:type => "http",
|
19
|
+
:port => 80
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
tests("#create_load_balancer(#{create_options.inspect})") do
|
24
|
+
pending if Fog.mocking?
|
25
|
+
result = Fog::Compute[:brightbox].create_load_balancer(create_options)
|
26
|
+
@load_balancer_id = result["id"]
|
27
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, :allow_extra_keys => true) { result }
|
28
|
+
end
|
29
|
+
|
30
|
+
unless Fog.mocking?
|
31
|
+
Fog::Compute[:brightbox].load_balancers.get(@load_balancer_id).wait_for { ready? }
|
32
|
+
end
|
33
|
+
|
34
|
+
tests("#list_load_balancers()") do
|
35
|
+
pending if Fog.mocking?
|
36
|
+
result = Fog::Compute[:brightbox].list_load_balancers
|
37
|
+
data_matches_schema(Brightbox::Compute::Formats::Collection::LOAD_BALANCERS, :allow_extra_keys => true) { result }
|
38
|
+
end
|
39
|
+
|
40
|
+
tests("#get_load_balancer('#{@load_balancer_id}')") do
|
41
|
+
pending if Fog.mocking?
|
42
|
+
result = Fog::Compute[:brightbox].get_load_balancer(@load_balancer_id)
|
43
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, :allow_extra_keys => true) { result }
|
44
|
+
end
|
45
|
+
|
46
|
+
update_options = { :name => "New name" }
|
47
|
+
tests("#update_load_balancer('#{@load_balancer_id}', #{update_options.inspect})") do
|
48
|
+
pending if Fog.mocking?
|
49
|
+
result = Fog::Compute[:brightbox].update_load_balancer(@load_balancer_id, update_options)
|
50
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, :allow_extra_keys => true) { result }
|
51
|
+
end
|
52
|
+
|
53
|
+
add_listeners_options = { :listeners => [{ :out => 28_080, :in => 8080, :protocol => "http" }] }
|
54
|
+
tests("#add_listeners_load_balancer('#{@load_balancer_id}', #{add_listeners_options.inspect})") do
|
55
|
+
pending if Fog.mocking?
|
56
|
+
result = Fog::Compute[:brightbox].add_listeners_load_balancer(@load_balancer_id, add_listeners_options)
|
57
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, :allow_extra_keys => true) { result }
|
58
|
+
end
|
59
|
+
|
60
|
+
remove_listeners_options = { :listeners => [{ :out => 28_080, :in => 8080, :protocol => "http" }] }
|
61
|
+
tests("#remove_listeners_load_balancer('#{@load_balancer_id}', #{remove_listeners_options.inspect})") do
|
62
|
+
pending if Fog.mocking?
|
63
|
+
result = Fog::Compute[:brightbox].remove_listeners_load_balancer(@load_balancer_id, remove_listeners_options)
|
64
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, :allow_extra_keys => true) { result }
|
65
|
+
end
|
66
|
+
|
67
|
+
unless Fog.mocking?
|
68
|
+
@node2 = Brightbox::Compute::TestSupport.get_test_server
|
69
|
+
second_node_id = @node2.id
|
70
|
+
end
|
71
|
+
|
72
|
+
# Can't remove the last node so we need to add a second...
|
73
|
+
add_nodes_options = { :nodes => [{ :node => second_node_id }] }
|
74
|
+
tests("#add_nodes_load_balancer('#{@load_balancer_id}', #{add_nodes_options.inspect})") do
|
75
|
+
pending if Fog.mocking?
|
76
|
+
result = Fog::Compute[:brightbox].add_nodes_load_balancer(@load_balancer_id, add_nodes_options)
|
77
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, :allow_extra_keys => true) { result }
|
78
|
+
end
|
79
|
+
|
80
|
+
# ...before we can attempt to remove either
|
81
|
+
remove_nodes_options = { :nodes => [{ :node => node_id }] }
|
82
|
+
tests("#remove_nodes_load_balancer('#{@load_balancer_id}', #{remove_nodes_options.inspect})") do
|
83
|
+
pending if Fog.mocking?
|
84
|
+
result = Fog::Compute[:brightbox].remove_nodes_load_balancer(@load_balancer_id, remove_nodes_options)
|
85
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, :allow_extra_keys => true) { result }
|
86
|
+
end
|
87
|
+
|
88
|
+
tests("#destroy_load_balancer('#{@load_balancer_id}')") do
|
89
|
+
pending if Fog.mocking?
|
90
|
+
result = Fog::Compute[:brightbox].destroy_load_balancer(@load_balancer_id)
|
91
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, :allow_extra_keys => true) { result }
|
92
|
+
end
|
93
|
+
|
94
|
+
unless Fog.mocking?
|
95
|
+
@node.destroy
|
96
|
+
@node2.destroy
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
tests("failure") do
|
101
|
+
tests("#create_load_balancer").raises(ArgumentError) do
|
102
|
+
pending if Fog.mocking?
|
103
|
+
Fog::Compute[:brightbox].create_load_balancer
|
104
|
+
end
|
105
|
+
|
106
|
+
tests("#get_load_balancer('lba-00000')").raises(Excon::Errors::NotFound) do
|
107
|
+
pending if Fog.mocking?
|
108
|
+
Fog::Compute[:brightbox].get_load_balancer("lba-00000")
|
109
|
+
end
|
110
|
+
|
111
|
+
tests("#get_load_balancer").raises(ArgumentError) do
|
112
|
+
pending if Fog.mocking?
|
113
|
+
Fog::Compute[:brightbox].get_load_balancer
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
Shindo.tests("Fog::Compute[:brightbox] | server group requests", ["brightbox"]) do
|
2
|
+
tests("success") do
|
3
|
+
unless Fog.mocking?
|
4
|
+
@server = Brightbox::Compute::TestSupport.get_test_server
|
5
|
+
server_id = @server.id
|
6
|
+
end
|
7
|
+
|
8
|
+
create_options = {
|
9
|
+
:name => "Fog@#{Time.now.iso8601}",
|
10
|
+
:servers => [{
|
11
|
+
:server => server_id
|
12
|
+
}]
|
13
|
+
}
|
14
|
+
|
15
|
+
tests("#create_server_group(#{create_options.inspect})") do
|
16
|
+
pending if Fog.mocking?
|
17
|
+
result = Fog::Compute[:brightbox].create_server_group(create_options)
|
18
|
+
@server_group_id = result["id"]
|
19
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, :allow_extra_keys => true) { result }
|
20
|
+
end
|
21
|
+
|
22
|
+
tests("#list_server_groups") do
|
23
|
+
pending if Fog.mocking?
|
24
|
+
result = Fog::Compute[:brightbox].list_server_groups
|
25
|
+
data_matches_schema(Brightbox::Compute::Formats::Collection::SERVER_GROUPS, :allow_extra_keys => true) { result }
|
26
|
+
@default_group_id = result.find { |grp| grp["default"] == true }["id"]
|
27
|
+
end
|
28
|
+
|
29
|
+
tests("#get_server_group('#{@server_group_id}')") do
|
30
|
+
pending if Fog.mocking?
|
31
|
+
result = Fog::Compute[:brightbox].get_server_group(@server_group_id)
|
32
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, :allow_extra_keys => true) { result }
|
33
|
+
end
|
34
|
+
|
35
|
+
update_options = { :name => "Fog@#{Time.now.iso8601}" }
|
36
|
+
tests("#update_server_group('#{@server_group_id}', #{update_options.inspect})") do
|
37
|
+
pending if Fog.mocking?
|
38
|
+
result = Fog::Compute[:brightbox].update_server_group(@server_group_id, update_options)
|
39
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, :allow_extra_keys => true) { result }
|
40
|
+
end
|
41
|
+
|
42
|
+
remove_options = { :servers => [{ :server => server_id }] }
|
43
|
+
tests("#remove_servers_server_group('#{@server_group_id}', #{remove_options.inspect})") do
|
44
|
+
pending if Fog.mocking?
|
45
|
+
result = Fog::Compute[:brightbox].remove_servers_server_group(@server_group_id, remove_options)
|
46
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, :allow_extra_keys => true) { result }
|
47
|
+
end
|
48
|
+
|
49
|
+
add_options = { :servers => [{ :server => server_id }] }
|
50
|
+
tests("#add_servers_server_group('#{@server_group_id}', #{remove_options.inspect})") do
|
51
|
+
pending if Fog.mocking?
|
52
|
+
result = Fog::Compute[:brightbox].add_servers_server_group(@server_group_id, add_options)
|
53
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, :allow_extra_keys => true) { result }
|
54
|
+
end
|
55
|
+
|
56
|
+
move_options = { :destination => @default_group_id, :servers => [{ :server => server_id }] }
|
57
|
+
tests("#move_servers_server_group('#{@server_group_id}', #{move_options.inspect})") do
|
58
|
+
pending if Fog.mocking?
|
59
|
+
result = Fog::Compute[:brightbox].move_servers_server_group(@server_group_id, move_options)
|
60
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, :allow_extra_keys => true) { result }
|
61
|
+
test("group is emptied") { result["servers"].empty? }
|
62
|
+
end
|
63
|
+
|
64
|
+
tests("#destroy_server_group('#{@server_group_id}')") do
|
65
|
+
pending if Fog.mocking?
|
66
|
+
result = Fog::Compute[:brightbox].destroy_server_group(@server_group_id)
|
67
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, :allow_extra_keys => true) { result }
|
68
|
+
end
|
69
|
+
|
70
|
+
unless Fog.mocking?
|
71
|
+
@server.destroy
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
tests("failure") do
|
76
|
+
tests("#create_server_group").raises(ArgumentError) do
|
77
|
+
pending if Fog.mocking?
|
78
|
+
Fog::Compute[:brightbox].create_server_group
|
79
|
+
end
|
80
|
+
|
81
|
+
tests("#get_server_group('grp-00000')").raises(Excon::Errors::NotFound) do
|
82
|
+
pending if Fog.mocking?
|
83
|
+
Fog::Compute[:brightbox].get_server_group("grp-00000")
|
84
|
+
end
|
85
|
+
|
86
|
+
tests("#get_server_group").raises(ArgumentError) do
|
87
|
+
pending if Fog.mocking?
|
88
|
+
Fog::Compute[:brightbox].get_server_group
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
Shindo.tests("Fog::Compute[:brightbox] | server requests", ["brightbox"]) do
|
2
|
+
tests("success") do
|
3
|
+
unless Fog.mocking?
|
4
|
+
image_id = Brightbox::Compute::TestSupport.image_id
|
5
|
+
server_id = nil
|
6
|
+
end
|
7
|
+
|
8
|
+
tests("#create_server(:image => '#{image_id}')") do
|
9
|
+
pending if Fog.mocking?
|
10
|
+
result = Fog::Compute[:brightbox].create_server(:image => image_id)
|
11
|
+
server_id = result["id"]
|
12
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, :allow_extra_keys => true) { result }
|
13
|
+
end
|
14
|
+
|
15
|
+
unless Fog.mocking?
|
16
|
+
Fog::Compute[:brightbox].servers.get(server_id).wait_for { ready? }
|
17
|
+
end
|
18
|
+
|
19
|
+
tests("#list_servers") do
|
20
|
+
pending if Fog.mocking?
|
21
|
+
result = Fog::Compute[:brightbox].list_servers
|
22
|
+
data_matches_schema(Brightbox::Compute::Formats::Collection::SERVERS, :allow_extra_keys => true) { result }
|
23
|
+
end
|
24
|
+
|
25
|
+
tests("#get_server('#{server_id}')") do
|
26
|
+
pending if Fog.mocking?
|
27
|
+
result = Fog::Compute[:brightbox].get_server(server_id)
|
28
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, :allow_extra_keys => true) { result }
|
29
|
+
end
|
30
|
+
|
31
|
+
tests("#update_server('#{server_id}')") do
|
32
|
+
pending if Fog.mocking?
|
33
|
+
result = Fog::Compute[:brightbox].update_server(server_id, :name => "Fog@#{Time.now.iso8601}")
|
34
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, :allow_extra_keys => true) { result }
|
35
|
+
end
|
36
|
+
|
37
|
+
tests("#activate_console_server('#{server_id}')") do
|
38
|
+
pending if Fog.mocking?
|
39
|
+
result = Fog::Compute[:brightbox].activate_console_server(server_id)
|
40
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, :allow_extra_keys => true) { result }
|
41
|
+
test("has set 'console_url'") { !result["console_url"].empty? }
|
42
|
+
test("has set 'console_token'") { !result["console_token"].empty? }
|
43
|
+
test("has set 'console_token_expires'") { !result["console_token_expires"].empty? }
|
44
|
+
end
|
45
|
+
|
46
|
+
tests("#stop_server('#{server_id}')") do
|
47
|
+
pending if Fog.mocking?
|
48
|
+
result = Fog::Compute[:brightbox].stop_server(server_id)
|
49
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, :allow_extra_keys => true) { result }
|
50
|
+
end
|
51
|
+
|
52
|
+
tests("#start_server('#{server_id}')") do
|
53
|
+
pending if Fog.mocking?
|
54
|
+
result = Fog::Compute[:brightbox].start_server(server_id)
|
55
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, :allow_extra_keys => true) { result }
|
56
|
+
end
|
57
|
+
|
58
|
+
tests("#shutdown_server('#{server_id}')") do
|
59
|
+
pending if Fog.mocking?
|
60
|
+
result = Fog::Compute[:brightbox].shutdown_server(server_id)
|
61
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, :allow_extra_keys => true) { result }
|
62
|
+
end
|
63
|
+
|
64
|
+
tests("#snapshot_server('#{server_id}')") do
|
65
|
+
pending if Fog.mocking?
|
66
|
+
result = Fog::Compute[:brightbox].snapshot_server(server_id)
|
67
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, :allow_extra_keys => true) { result }
|
68
|
+
# Server should be exclusively for our test so assume we can delete the snapshot
|
69
|
+
snapshot_id = result["snapshots"].first["id"]
|
70
|
+
@snapshot = Fog::Compute[:brightbox].images.get(snapshot_id)
|
71
|
+
@snapshot.wait_for { ready? }
|
72
|
+
@snapshot.destroy
|
73
|
+
end
|
74
|
+
|
75
|
+
tests("#destroy_server('#{server_id}')") do
|
76
|
+
pending if Fog.mocking?
|
77
|
+
result = Fog::Compute[:brightbox].destroy_server(server_id)
|
78
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, :allow_extra_keys => true) { result }
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
tests("failure") do
|
83
|
+
tests("#get_server('srv-00000')").raises(Excon::Errors::NotFound) do
|
84
|
+
pending if Fog.mocking?
|
85
|
+
Fog::Compute[:brightbox].get_server("srv-00000")
|
86
|
+
end
|
87
|
+
|
88
|
+
tests("#get_server").raises(ArgumentError) do
|
89
|
+
pending if Fog.mocking?
|
90
|
+
Fog::Compute[:brightbox].get_server
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Shindo.tests("Fog::Compute[:brightbox] | server type requests", ["brightbox"]) do
|
2
|
+
tests("success") do
|
3
|
+
tests("#list_server_types") do
|
4
|
+
pending if Fog.mocking?
|
5
|
+
result = Fog::Compute[:brightbox].list_server_types
|
6
|
+
@server_type_id = result.first["id"]
|
7
|
+
data_matches_schema(Brightbox::Compute::Formats::Collection::SERVER_TYPES, :allow_extra_keys => true) { result }
|
8
|
+
end
|
9
|
+
|
10
|
+
tests("#get_server_type('#{@server_type_id}')") do
|
11
|
+
pending if Fog.mocking?
|
12
|
+
result = Fog::Compute[:brightbox].get_server_type(@server_type_id)
|
13
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_TYPE, :allow_extra_keys => true) { result }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
tests("failure") do
|
18
|
+
tests("#get_server_type('typ-00000')").raises(Excon::Errors::NotFound) do
|
19
|
+
pending if Fog.mocking?
|
20
|
+
Fog::Compute[:brightbox].get_server_type("typ-00000")
|
21
|
+
end
|
22
|
+
|
23
|
+
tests("#get_server").raises(ArgumentError) do
|
24
|
+
pending if Fog.mocking?
|
25
|
+
Fog::Compute[:brightbox].get_server_type
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
Shindo.tests("Fog::Compute[:brightbox] | user collaboration requests", ["brightbox"]) do
|
2
|
+
@service = Fog::Compute[:brightbox]
|
3
|
+
|
4
|
+
tests("when accessing with user application") do
|
5
|
+
pending unless @service.authenticating_as_user?
|
6
|
+
tests("success") do
|
7
|
+
tests("#list_user_collaborations") do
|
8
|
+
pending if Fog.mocking?
|
9
|
+
result = @service.list_user_collaborations
|
10
|
+
|
11
|
+
formats(Brightbox::Compute::Formats::Collection::COLLABORATIONS, false) { result }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
tests("failure") do
|
16
|
+
tests("get_user_collaboration('col-abcde')").raises(Excon::Errors::NotFound) do
|
17
|
+
pending if Fog.mocking?
|
18
|
+
|
19
|
+
@service.get_user_collaboration("col-abcde")
|
20
|
+
end
|
21
|
+
|
22
|
+
tests("accept_user_collaboration('col-abcde')").raises(Excon::Errors::NotFound) do
|
23
|
+
pending if Fog.mocking?
|
24
|
+
|
25
|
+
@service.accept_user_collaboration("col-abcde")
|
26
|
+
end
|
27
|
+
|
28
|
+
tests("reject_user_collaboration('col-abcde')").raises(Excon::Errors::NotFound) do
|
29
|
+
pending if Fog.mocking?
|
30
|
+
|
31
|
+
@service.reject_user_collaboration("col-abcde")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
tests("when accessing with API client") do
|
37
|
+
pending if @service.authenticating_as_user?
|
38
|
+
tests("forbidden") do
|
39
|
+
tests("#list_user_collaborations").raises(Excon::Errors::Forbidden) do
|
40
|
+
pending if Fog.mocking?
|
41
|
+
result = @service.list_user_collaborations
|
42
|
+
|
43
|
+
formats(Brightbox::Compute::Formats::Collection::COLLABORATIONS, false) { result }
|
44
|
+
end
|
45
|
+
|
46
|
+
tests("get_user_collaboration('col-abcde')").raises(Excon::Errors::Forbidden) do
|
47
|
+
pending if Fog.mocking?
|
48
|
+
|
49
|
+
@service.get_user_collaboration("col-abcde")
|
50
|
+
end
|
51
|
+
|
52
|
+
tests("accept_user_collaboration('col-abcde')").raises(Excon::Errors::Forbidden) do
|
53
|
+
pending if Fog.mocking?
|
54
|
+
|
55
|
+
@service.accept_user_collaboration("col-abcde")
|
56
|
+
end
|
57
|
+
|
58
|
+
tests("reject_user_collaboration('col-abcde')").raises(Excon::Errors::Forbidden) do
|
59
|
+
pending if Fog.mocking?
|
60
|
+
|
61
|
+
@service.reject_user_collaboration("col-abcde")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
Shindo.tests("Fog::Compute[:brightbox] | user requests", ["brightbox"]) do
|
2
|
+
tests("success") do
|
3
|
+
tests("#list_users") do
|
4
|
+
pending if Fog.mocking?
|
5
|
+
result = Fog::Compute[:brightbox].list_users
|
6
|
+
@user_id = result.first["id"]
|
7
|
+
data_matches_schema(Brightbox::Compute::Formats::Collection::USERS, :allow_extra_keys => true) { result }
|
8
|
+
end
|
9
|
+
|
10
|
+
tests("#get_user('#{@user_id}')") do
|
11
|
+
pending if Fog.mocking?
|
12
|
+
result = Fog::Compute[:brightbox].get_user(@user_id)
|
13
|
+
@current_name = result["name"]
|
14
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::USER, :allow_extra_keys => true) { result }
|
15
|
+
end
|
16
|
+
|
17
|
+
# Rather than setting the name to something useless we set it to the original value
|
18
|
+
update_options = { :name => @current_name }
|
19
|
+
tests("#update_user('#{@user_id}', #{update_options.inspect})") do
|
20
|
+
pending if Fog.mocking?
|
21
|
+
result = Fog::Compute[:brightbox].update_user(@user_id, update_options)
|
22
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::USER, :allow_extra_keys => true) { result }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
tests("failure") do
|
27
|
+
tests("#update_user").raises(ArgumentError) do
|
28
|
+
pending if Fog.mocking?
|
29
|
+
Fog::Compute[:brightbox].update_user
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Shindo.tests("Fog::Compute[:brightbox] | zone requests", ["brightbox"]) do
|
2
|
+
tests("success") do
|
3
|
+
tests("#list_zones") do
|
4
|
+
pending if Fog.mocking?
|
5
|
+
result = Fog::Compute[:brightbox].list_zones
|
6
|
+
@zone_id = result.first["id"]
|
7
|
+
data_matches_schema(Brightbox::Compute::Formats::Collection::ZONES, :allow_extra_keys => true) { result }
|
8
|
+
end
|
9
|
+
|
10
|
+
tests("#get_zone('#{@zone_id}')") do
|
11
|
+
pending if Fog.mocking?
|
12
|
+
result = Fog::Compute[:brightbox].get_zone(@zone_id)
|
13
|
+
data_matches_schema(Brightbox::Compute::Formats::Full::ZONE, :allow_extra_keys => true) { result }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
tests("failure") do
|
18
|
+
tests("#get_zone('zon-00000')").raises(Excon::Errors::NotFound) do
|
19
|
+
pending if Fog.mocking?
|
20
|
+
Fog::Compute[:brightbox].get_zone("zon-00000")
|
21
|
+
end
|
22
|
+
|
23
|
+
tests("#get_zone").raises(ArgumentError) do
|
24
|
+
pending if Fog.mocking?
|
25
|
+
Fog::Compute[:brightbox].get_zone
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|