fog-brightbox 1.10.0 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +20 -3
  3. data/.rubocop.yml +15 -10
  4. data/CHANGELOG.md +34 -0
  5. data/README.md +6 -0
  6. data/Rakefile +1 -1
  7. data/fog-brightbox.gemspec +9 -3
  8. data/lib/fog/brightbox/compute/shared.rb +11 -10
  9. data/lib/fog/brightbox/compute.rb +20 -21
  10. data/lib/fog/brightbox/config.rb +6 -9
  11. data/lib/fog/brightbox/models/compute/api_client.rb +4 -4
  12. data/lib/fog/brightbox/models/compute/application.rb +2 -2
  13. data/lib/fog/brightbox/models/compute/cloud_ip.rb +11 -11
  14. data/lib/fog/brightbox/models/compute/collaboration.rb +3 -3
  15. data/lib/fog/brightbox/models/compute/collaborations.rb +1 -1
  16. data/lib/fog/brightbox/models/compute/config_map.rb +2 -3
  17. data/lib/fog/brightbox/models/compute/database_server.rb +17 -5
  18. data/lib/fog/brightbox/models/compute/database_snapshot.rb +2 -2
  19. data/lib/fog/brightbox/models/compute/firewall_policy.rb +6 -6
  20. data/lib/fog/brightbox/models/compute/firewall_rule.rb +9 -9
  21. data/lib/fog/brightbox/models/compute/image.rb +9 -9
  22. data/lib/fog/brightbox/models/compute/load_balancer.rb +12 -12
  23. data/lib/fog/brightbox/models/compute/server.rb +21 -23
  24. data/lib/fog/brightbox/models/compute/server_group.rb +6 -6
  25. data/lib/fog/brightbox/models/compute/user.rb +3 -3
  26. data/lib/fog/brightbox/models/compute/volume.rb +16 -16
  27. data/lib/fog/brightbox/models/storage/directories.rb +2 -2
  28. data/lib/fog/brightbox/models/storage/directory.rb +7 -7
  29. data/lib/fog/brightbox/models/storage/file.rb +13 -13
  30. data/lib/fog/brightbox/models/storage/files.rb +9 -13
  31. data/lib/fog/brightbox/oauth2.rb +13 -11
  32. data/lib/fog/brightbox/requests/compute/list_accounts.rb +1 -1
  33. data/lib/fog/brightbox/requests/compute/reset_database_server.rb +21 -0
  34. data/lib/fog/brightbox/requests/compute/resize_database_server.rb +25 -0
  35. data/lib/fog/brightbox/requests/compute/snapshot_database_server.rb +1 -1
  36. data/lib/fog/brightbox/requests/compute/snapshot_server.rb +1 -1
  37. data/lib/fog/brightbox/requests/storage/copy_object.rb +5 -5
  38. data/lib/fog/brightbox/requests/storage/delete_container.rb +3 -3
  39. data/lib/fog/brightbox/requests/storage/delete_multiple_objects.rb +7 -7
  40. data/lib/fog/brightbox/requests/storage/delete_object.rb +3 -3
  41. data/lib/fog/brightbox/requests/storage/delete_static_large_object.rb +6 -6
  42. data/lib/fog/brightbox/requests/storage/get_container.rb +4 -4
  43. data/lib/fog/brightbox/requests/storage/get_containers.rb +4 -4
  44. data/lib/fog/brightbox/requests/storage/get_object.rb +4 -6
  45. data/lib/fog/brightbox/requests/storage/get_object_http_url.rb +1 -1
  46. data/lib/fog/brightbox/requests/storage/get_object_https_url.rb +1 -1
  47. data/lib/fog/brightbox/requests/storage/head_container.rb +4 -4
  48. data/lib/fog/brightbox/requests/storage/head_containers.rb +4 -4
  49. data/lib/fog/brightbox/requests/storage/head_object.rb +3 -3
  50. data/lib/fog/brightbox/requests/storage/post_set_meta_temp_url_key.rb +3 -3
  51. data/lib/fog/brightbox/requests/storage/put_container.rb +4 -4
  52. data/lib/fog/brightbox/requests/storage/put_dynamic_obj_manifest.rb +4 -4
  53. data/lib/fog/brightbox/requests/storage/put_object.rb +7 -7
  54. data/lib/fog/brightbox/requests/storage/put_static_obj_manifest.rb +6 -6
  55. data/lib/fog/brightbox/storage/authentication_request.rb +4 -4
  56. data/lib/fog/brightbox/storage/connection.rb +2 -2
  57. data/lib/fog/brightbox/storage.rb +13 -14
  58. data/lib/fog/brightbox/version.rb +1 -1
  59. data/spec/fog/brightbox/compute/config_spec.rb +4 -4
  60. data/spec/fog/brightbox/compute/get_access_token_spec.rb +28 -28
  61. data/spec/fog/brightbox/compute/wrapped_request_spec.rb +23 -23
  62. data/spec/fog/brightbox/config_spec.rb +23 -23
  63. data/spec/fog/brightbox/oauth2/client_credentials_strategy_spec.rb +2 -2
  64. data/spec/fog/brightbox/oauth2/credential_set_spec.rb +5 -5
  65. data/spec/fog/brightbox/oauth2/grant_type_strategy_spec.rb +2 -2
  66. data/spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb +3 -3
  67. data/spec/fog/brightbox/oauth2/user_credentials_strategy_spec.rb +4 -4
  68. data/spec/fog/brightbox/storage/authentication_request_spec.rb +41 -34
  69. data/spec/fog/brightbox/storage/config_spec.rb +4 -4
  70. data/spec/fog/brightbox/storage/connection_errors_spec.rb +6 -6
  71. data/spec/fog/brightbox/storage/connection_spec.rb +37 -37
  72. data/spec/fog/brightbox/storage/directory_spec.rb +6 -6
  73. data/spec/fog/brightbox/storage/files_spec.rb +5 -5
  74. data/spec/fog/brightbox/storage_spec.rb +5 -5
  75. data/spec/fog/compute/brightbox/database_server_spec.rb +19 -19
  76. data/spec/fog/compute/brightbox/image_selector_spec.rb +18 -18
  77. data/spec/fog/compute/brightbox/load_balancer_spec.rb +5 -5
  78. data/spec/fog/compute/brightbox/server_spec.rb +44 -44
  79. data/spec/fog/compute/brightbox/volume_spec.rb +68 -69
  80. data/spec/fog/compute/brightbox_spec.rb +16 -10
  81. data/spec/fog/storage/brightbox_spec.rb +83 -83
  82. data/spec/model_setup.rb +9 -9
  83. data/spec/stock_storage_responses.rb +9 -9
  84. data/spec/supports_resource_locking.rb +6 -6
  85. data/tests/brightbox/compute/schema.rb +74 -74
  86. data/tests/brightbox/compute_tests.rb +14 -14
  87. data/tests/brightbox/models/compute/account_tests.rb +0 -10
  88. data/tests/brightbox/models/compute/server_tests.rb +0 -1
  89. data/tests/brightbox/requests/compute/account_tests.rb +7 -21
  90. data/tests/brightbox/requests/compute/api_client_tests.rb +9 -9
  91. data/tests/brightbox/requests/compute/application_test.rb +8 -8
  92. data/tests/brightbox/requests/compute/cloud_ip_tests.rb +11 -13
  93. data/tests/brightbox/requests/compute/collaboration_tests.rb +1 -1
  94. data/tests/brightbox/requests/compute/database_server_tests.rb +7 -7
  95. data/tests/brightbox/requests/compute/database_snapsnot_tests.rb +5 -5
  96. data/tests/brightbox/requests/compute/database_type_tests.rb +1 -1
  97. data/tests/brightbox/requests/compute/firewall_policy_tests.rb +7 -7
  98. data/tests/brightbox/requests/compute/firewall_rule_tests.rb +8 -10
  99. data/tests/brightbox/requests/compute/helper.rb +1 -1
  100. data/tests/brightbox/requests/compute/image_tests.rb +2 -2
  101. data/tests/brightbox/requests/compute/interface_tests.rb +1 -1
  102. data/tests/brightbox/requests/compute/load_balancer_tests.rb +23 -23
  103. data/tests/brightbox/requests/compute/server_group_tests.rb +16 -18
  104. data/tests/brightbox/requests/compute/server_tests.rb +12 -12
  105. data/tests/brightbox/requests/compute/server_type_tests.rb +2 -2
  106. data/tests/brightbox/requests/compute/user_tests.rb +4 -4
  107. data/tests/brightbox/requests/compute/volume_tests.rb +5 -5
  108. data/tests/brightbox/requests/compute/zone_tests.rb +2 -2
  109. data/tests/helper.rb +1 -1
  110. data/tests/helpers/collection_helper.rb +16 -23
  111. data/tests/helpers/compute/server_helper.rb +4 -6
  112. data/tests/helpers/formats_helper.rb +5 -5
  113. data/tests/helpers/formats_helper_tests.rb +16 -16
  114. data/tests/helpers/mock_helper.rb +84 -86
  115. data/tests/helpers/model_helper.rb +1 -3
  116. data/tests/helpers/schema_validator_tests.rb +14 -14
  117. metadata +22 -7
  118. data/.rubocop_todo.yml +0 -81
@@ -16,7 +16,7 @@ describe Fog::Brightbox::Config do
16
16
  describe "when created with a Hash" do
17
17
  it "does not error" do
18
18
  @options = {
19
- :brightbox_client_id => "cli-12345"
19
+ brightbox_client_id: "cli-12345"
20
20
  }
21
21
  @config = Fog::Brightbox::Config.new(@options)
22
22
  assert_instance_of Fog::Brightbox::Config, @config
@@ -25,7 +25,7 @@ describe Fog::Brightbox::Config do
25
25
 
26
26
  describe "when auth url options was passed" do
27
27
  it "returns the setting" do
28
- @options = { :brightbox_auth_url => "https://api.gb1.brightbox.com" }
28
+ @options = { brightbox_auth_url: "https://api.gb1.brightbox.com" }
29
29
  @config = Fog::Brightbox::Config.new(@options)
30
30
  assert_instance_of URI::HTTPS, @config.auth_url
31
31
  end
@@ -41,7 +41,7 @@ describe Fog::Brightbox::Config do
41
41
 
42
42
  describe "when compute url options was passed" do
43
43
  it "returns the setting" do
44
- @options = { :brightbox_api_url => "https://api.gb1.brightbox.com" }
44
+ @options = { brightbox_api_url: "https://api.gb1.brightbox.com" }
45
45
  @config = Fog::Brightbox::Config.new(@options)
46
46
  assert_instance_of URI::HTTPS, @config.compute_url
47
47
  assert_equal @config.compute_url, @config.api_url
@@ -59,7 +59,7 @@ describe Fog::Brightbox::Config do
59
59
 
60
60
  describe "when client id is passed" do
61
61
  it "returns the settings" do
62
- @options = { :brightbox_client_id => "cli-12345" }
62
+ @options = { brightbox_client_id: "cli-12345" }
63
63
  @config = Fog::Brightbox::Config.new(@options)
64
64
  assert_equal "cli-12345", @config.client_id
65
65
  end
@@ -67,7 +67,7 @@ describe Fog::Brightbox::Config do
67
67
 
68
68
  describe "when client secret is passed" do
69
69
  it "returns the settings" do
70
- @options = { :brightbox_secret => "secret" }
70
+ @options = { brightbox_secret: "secret" }
71
71
  @config = Fog::Brightbox::Config.new(@options)
72
72
  assert_equal "secret", @config.client_secret
73
73
  end
@@ -75,7 +75,7 @@ describe Fog::Brightbox::Config do
75
75
 
76
76
  describe "when username is passed" do
77
77
  it "returns the settings" do
78
- @options = { :brightbox_username => "usr-12345" }
78
+ @options = { brightbox_username: "usr-12345" }
79
79
  @config = Fog::Brightbox::Config.new(@options)
80
80
  assert_equal "usr-12345", @config.username
81
81
  end
@@ -83,7 +83,7 @@ describe Fog::Brightbox::Config do
83
83
 
84
84
  describe "when password is passed" do
85
85
  it "returns the settings" do
86
- @options = { :brightbox_password => "password" }
86
+ @options = { brightbox_password: "password" }
87
87
  @config = Fog::Brightbox::Config.new(@options)
88
88
  assert_equal "password", @config.password
89
89
  end
@@ -91,7 +91,7 @@ describe Fog::Brightbox::Config do
91
91
 
92
92
  describe "when account is passed" do
93
93
  it "returns the settings" do
94
- @options = { :brightbox_account => "acc-12345" }
94
+ @options = { brightbox_account: "acc-12345" }
95
95
  @config = Fog::Brightbox::Config.new(@options)
96
96
  assert_equal "acc-12345", @config.account
97
97
  end
@@ -99,7 +99,7 @@ describe Fog::Brightbox::Config do
99
99
 
100
100
  describe "when account was passed but changed" do
101
101
  it "returns the new account" do
102
- @options = { :brightbox_account => "acc-12345" }
102
+ @options = { brightbox_account: "acc-12345" }
103
103
  @config = Fog::Brightbox::Config.new(@options)
104
104
  @config.change_account("acc-abcde")
105
105
  assert_equal "acc-abcde", @config.account
@@ -108,7 +108,7 @@ describe Fog::Brightbox::Config do
108
108
 
109
109
  describe "when account was passed, changed and reset" do
110
110
  it "returns the original account" do
111
- @options = { :brightbox_account => "acc-12345" }
111
+ @options = { brightbox_account: "acc-12345" }
112
112
  @config = Fog::Brightbox::Config.new(@options)
113
113
  @config.change_account("acc-abcde")
114
114
  @config.reset_account
@@ -119,12 +119,12 @@ describe Fog::Brightbox::Config do
119
119
  describe "when connection options are passed" do
120
120
  it "returns the settings" do
121
121
  @connection_settings = {
122
- :headers => {
122
+ headers: {
123
123
  "Content-Type" => "application/json"
124
124
  }
125
125
  }
126
126
  @options = {
127
- :connection_options => @connection_settings
127
+ connection_options: @connection_settings
128
128
  }
129
129
  @config = Fog::Brightbox::Config.new(@options)
130
130
  assert_equal @connection_settings, @config.connection_options
@@ -140,7 +140,7 @@ describe Fog::Brightbox::Config do
140
140
 
141
141
  describe "when persistent connection is requested" do
142
142
  it "returns true for the setting" do
143
- @options = { :persistent => true }
143
+ @options = { persistent: true }
144
144
  @config = Fog::Brightbox::Config.new(@options)
145
145
  assert @config.connection_persistent?
146
146
  end
@@ -158,8 +158,8 @@ describe Fog::Brightbox::Config do
158
158
  @access_token = "1234567890abcdefghijklmnopqrstuvwxyz"
159
159
  @refresh_token = "1234567890abcdefghijklmnopqrstuvwxyz"
160
160
  @options = {
161
- :brightbox_access_token => @access_token,
162
- :brightbox_refresh_token => @refresh_token
161
+ brightbox_access_token: @access_token,
162
+ brightbox_refresh_token: @refresh_token
163
163
  }
164
164
  @config = Fog::Brightbox::Config.new(@options)
165
165
  end
@@ -194,7 +194,7 @@ describe Fog::Brightbox::Config do
194
194
 
195
195
  describe "when token management setting is disabled" do
196
196
  it "returns false" do
197
- @options = { :brightbox_token_management => false }
197
+ @options = { brightbox_token_management: false }
198
198
  @config = Fog::Brightbox::Config.new(@options)
199
199
  refute @config.managed_tokens?
200
200
  end
@@ -202,7 +202,7 @@ describe Fog::Brightbox::Config do
202
202
 
203
203
  describe "when a default server image is configured" do
204
204
  it "returns the configured setting" do
205
- @options = { :brightbox_default_image => "img-12345" }
205
+ @options = { brightbox_default_image: "img-12345" }
206
206
  @config = Fog::Brightbox::Config.new(@options)
207
207
  assert_equal "img-12345", @config.default_image_id
208
208
  end
@@ -218,10 +218,10 @@ describe Fog::Brightbox::Config do
218
218
  describe "when username and password are given" do
219
219
  it "user_credentials? returns true" do
220
220
  @options = {
221
- :brightbox_client_id => "app-12345",
222
- :brightbox_secret => "12345",
223
- :brightbox_username => "user@example.test",
224
- :brightbox_password => "12345"
221
+ brightbox_client_id: "app-12345",
222
+ brightbox_secret: "12345",
223
+ brightbox_username: "user@example.test",
224
+ brightbox_password: "12345"
225
225
  }
226
226
  @config = Fog::Brightbox::Config.new(@options)
227
227
  assert @config.user_credentials?
@@ -231,8 +231,8 @@ describe Fog::Brightbox::Config do
231
231
  describe "when no username is given" do
232
232
  it "user_credentials? returns false" do
233
233
  @options = {
234
- :brightbox_client_id => "cli-12345",
235
- :brightbox_secret => "12345"
234
+ brightbox_client_id: "cli-12345",
235
+ brightbox_secret: "12345"
236
236
  }
237
237
  @config = Fog::Brightbox::Config.new(@options)
238
238
  refute @config.user_credentials?
@@ -8,11 +8,11 @@ describe Fog::Brightbox::OAuth2::ClientCredentialsStrategy do
8
8
  @strategy = Fog::Brightbox::OAuth2::ClientCredentialsStrategy.new(@credentials)
9
9
  end
10
10
 
11
- it "tests #respond_to?(:authorization_body_data) returns true" do
11
+ it "tests #respond_to?(:authorization_body_data) returns true" do
12
12
  assert @strategy.respond_to?(:authorization_body_data)
13
13
  end
14
14
 
15
- it "tests #respond_to?(:headers) returns true" do
15
+ it "tests #respond_to?(:headers) returns true" do
16
16
  assert @strategy.respond_to?(:headers)
17
17
  end
18
18
 
@@ -35,7 +35,7 @@ describe Fog::Brightbox::OAuth2::CredentialSet do
35
35
 
36
36
  describe "when using user credentials" do
37
37
  before do
38
- options = { :username => @username, :password => @password }
38
+ options = { username: @username, password: @password }
39
39
  @credentials = Fog::Brightbox::OAuth2::CredentialSet.new(@client_id, @client_secret, options)
40
40
  end
41
41
 
@@ -59,10 +59,10 @@ describe Fog::Brightbox::OAuth2::CredentialSet do
59
59
  describe "when using refresh token" do
60
60
  before do
61
61
  options = {
62
- :username => @username,
63
- :access_token => @access_token,
64
- :refresh_token => @refresh_token,
65
- :expires_in => @expires_in
62
+ username: @username,
63
+ access_token: @access_token,
64
+ refresh_token: @refresh_token,
65
+ expires_in: @expires_in
66
66
  }
67
67
  @credentials = Fog::Brightbox::OAuth2::CredentialSet.new(@client_id, @client_secret, options)
68
68
  end
@@ -8,11 +8,11 @@ describe Fog::Brightbox::OAuth2::RefreshTokenStrategy do
8
8
  @strategy = Fog::Brightbox::OAuth2::GrantTypeStrategy.new(@credentials)
9
9
  end
10
10
 
11
- it "tests #respond_to?(:authorization_body_data) returns true" do
11
+ it "tests #respond_to?(:authorization_body_data) returns true" do
12
12
  assert @strategy.respond_to?(:authorization_body_data)
13
13
  end
14
14
 
15
- it "tests #respond_to?(:headers) returns true" do
15
+ it "tests #respond_to?(:headers) returns true" do
16
16
  assert @strategy.respond_to?(:headers)
17
17
  end
18
18
 
@@ -5,16 +5,16 @@ describe Fog::Brightbox::OAuth2::RefreshTokenStrategy do
5
5
  @client_id = "app-12345"
6
6
  @client_secret = "__mashed_keys_123__"
7
7
  @refresh_token = "ab4b39dddf909"
8
- options = { :refresh_token => @refresh_token }
8
+ options = { refresh_token: @refresh_token }
9
9
  @credentials = Fog::Brightbox::OAuth2::CredentialSet.new(@client_id, @client_secret, options)
10
10
  @strategy = Fog::Brightbox::OAuth2::RefreshTokenStrategy.new(@credentials)
11
11
  end
12
12
 
13
- it "tests #respond_to?(:authorization_body_data) returns true" do
13
+ it "tests #respond_to?(:authorization_body_data) returns true" do
14
14
  assert @strategy.respond_to?(:authorization_body_data)
15
15
  end
16
16
 
17
- it "tests #respond_to?(:headers) returns true" do
17
+ it "tests #respond_to?(:headers) returns true" do
18
18
  assert @strategy.respond_to?(:headers)
19
19
  end
20
20
 
@@ -8,19 +8,19 @@ describe Fog::Brightbox::OAuth2::UserCredentialsStrategy do
8
8
  @password = "__mushed_keys_321__"
9
9
 
10
10
  options = {
11
- :username => @username,
12
- :password => @password
11
+ username: @username,
12
+ password: @password
13
13
  }
14
14
 
15
15
  @credentials = Fog::Brightbox::OAuth2::CredentialSet.new(@client_id, @client_secret, options)
16
16
  @strategy = Fog::Brightbox::OAuth2::UserCredentialsStrategy.new(@credentials)
17
17
  end
18
18
 
19
- it "tests #respond_to?(:authorization_body_data) returns true" do
19
+ it "tests #respond_to?(:authorization_body_data) returns true" do
20
20
  assert @strategy.respond_to?(:authorization_body_data)
21
21
  end
22
22
 
23
- it "tests #respond_to?(:headers) returns true" do
23
+ it "tests #respond_to?(:headers) returns true" do
24
24
  assert @strategy.respond_to?(:headers)
25
25
  end
26
26
 
@@ -3,14 +3,21 @@ require "spec_helper"
3
3
  describe Fog::Brightbox::Storage::AuthenticationRequest do
4
4
  include StockStorageResponses
5
5
 
6
+ before do
7
+ # Excon v1.0 changes the behaviour and results in older versions of Ruby
8
+ # limited to v0.112.0 reporting failures since they can not match the Host
9
+ # header correctly.
10
+ Excon.defaults[:omit_default_port] = true
11
+ end
12
+
6
13
  describe "when initialised with blank config" do
7
14
  before do
8
- stub_request(:get, "https://orbit.brightbox.com/v1").
9
- with(:headers => {
10
- "Host" => "orbit.brightbox.com:443",
11
- "X-Auth-User" => "",
12
- "X-Auth-Key" => ""
13
- }).to_return(bad_url_response)
15
+ stub_request(:get, "https://orbit.brightbox.com/v1")
16
+ .with(headers: {
17
+ "Host" => "orbit.brightbox.com",
18
+ "X-Auth-User" => "",
19
+ "X-Auth-Key" => ""
20
+ }).to_return(bad_url_response)
14
21
  end
15
22
 
16
23
  it "raises error" do
@@ -23,18 +30,18 @@ describe Fog::Brightbox::Storage::AuthenticationRequest do
23
30
 
24
31
  describe "when initialised with API client details" do
25
32
  before do
26
- stub_request(:get, "https://orbit.brightbox.com/v1").
27
- with(:headers => {
28
- "Host" => "orbit.brightbox.com:443",
29
- "X-Auth-User" => "cli-12345",
30
- "X-Auth-Key" => "12345"
31
- }).to_return(authorized_response)
33
+ stub_request(:get, "https://orbit.brightbox.com/v1")
34
+ .with(headers: {
35
+ "Host" => "orbit.brightbox.com",
36
+ "X-Auth-User" => "cli-12345",
37
+ "X-Auth-Key" => "12345"
38
+ }).to_return(authorized_response)
32
39
  end
33
40
 
34
41
  it "authenticates correctly" do
35
42
  settings = {
36
- :brightbox_client_id => "cli-12345",
37
- :brightbox_secret => "12345"
43
+ brightbox_client_id: "cli-12345",
44
+ brightbox_secret: "12345"
38
45
  }
39
46
  @config = Fog::Brightbox::Config.new(settings)
40
47
  @request = Fog::Brightbox::Storage::AuthenticationRequest.new(@config)
@@ -44,20 +51,20 @@ describe Fog::Brightbox::Storage::AuthenticationRequest do
44
51
 
45
52
  describe "when initialised with user details" do
46
53
  before do
47
- stub_request(:get, "https://orbit.brightbox.com/v1").
48
- with(:headers => {
49
- "Host" => "orbit.brightbox.com:443",
50
- "X-Auth-User" => "user@example.test",
51
- "X-Auth-Key" => "abcde"
52
- }).to_return(authorized_response)
54
+ stub_request(:get, "https://orbit.brightbox.com/v1")
55
+ .with(headers: {
56
+ "Host" => "orbit.brightbox.com",
57
+ "X-Auth-User" => "user@example.test",
58
+ "X-Auth-Key" => "abcde"
59
+ }).to_return(authorized_response)
53
60
  end
54
61
 
55
62
  it "authenticates correctly" do
56
63
  settings = {
57
- :brightbox_client_id => "app-12345",
58
- :brightbox_secret => "12345",
59
- :brightbox_username => "user@example.test",
60
- :brightbox_password => "abcde"
64
+ brightbox_client_id: "app-12345",
65
+ brightbox_secret: "12345",
66
+ brightbox_username: "user@example.test",
67
+ brightbox_password: "abcde"
61
68
  }
62
69
  @config = Fog::Brightbox::Config.new(settings)
63
70
  @request = Fog::Brightbox::Storage::AuthenticationRequest.new(@config)
@@ -67,20 +74,20 @@ describe Fog::Brightbox::Storage::AuthenticationRequest do
67
74
 
68
75
  describe "when initialised with bad user details" do
69
76
  before do
70
- stub_request(:get, "https://orbit.brightbox.com/v1").
71
- with(:headers => {
72
- "Host" => "orbit.brightbox.com:443",
73
- "X-Auth-User" => "user@example.test",
74
- "X-Auth-Key" => "abcde"
75
- }).to_return(unauthorized_response)
77
+ stub_request(:get, "https://orbit.brightbox.com/v1")
78
+ .with(headers: {
79
+ "Host" => "orbit.brightbox.com",
80
+ "X-Auth-User" => "user@example.test",
81
+ "X-Auth-Key" => "abcde"
82
+ }).to_return(unauthorized_response)
76
83
  end
77
84
 
78
85
  it "raises error" do
79
86
  settings = {
80
- :brightbox_client_id => "app-12345",
81
- :brightbox_secret => "12345",
82
- :brightbox_username => "user@example.test",
83
- :brightbox_password => "abcde"
87
+ brightbox_client_id: "app-12345",
88
+ brightbox_secret: "12345",
89
+ brightbox_username: "user@example.test",
90
+ brightbox_password: "abcde"
84
91
  }
85
92
  @config = Fog::Brightbox::Config.new(settings)
86
93
  @request = Fog::Brightbox::Storage::AuthenticationRequest.new(@config)
@@ -5,8 +5,8 @@ describe Fog::Brightbox::Storage::Config do
5
5
  describe "when required arguments are included" do
6
6
  it "nothing is raised" do
7
7
  settings = {
8
- :brightbox_client_id => "cli-12345",
9
- :brightbox_secret => "1234567890"
8
+ brightbox_client_id: "cli-12345",
9
+ brightbox_secret: "1234567890"
10
10
  }
11
11
  config = Fog::Brightbox::Config.new(settings)
12
12
  Fog::Brightbox::Storage::Config.new(config)
@@ -17,7 +17,7 @@ describe Fog::Brightbox::Storage::Config do
17
17
  describe "when client_id is not in configuration" do
18
18
  it "raises ArgumentError" do
19
19
  settings = {
20
- :brightbox_secret => "1234567890"
20
+ brightbox_secret: "1234567890"
21
21
  }
22
22
  config = Fog::Brightbox::Config.new(settings)
23
23
  assert_raises ArgumentError do
@@ -29,7 +29,7 @@ describe Fog::Brightbox::Storage::Config do
29
29
  describe "when client_secret is not in configuration" do
30
30
  it "raises ArgumentError" do
31
31
  settings = {
32
- :brightbox_client_id => "cli-12345"
32
+ brightbox_client_id: "cli-12345"
33
33
  }
34
34
  config = Fog::Brightbox::Config.new(settings)
35
35
  assert_raises ArgumentError do
@@ -6,13 +6,13 @@ describe Fog::Brightbox::Storage::Connection do
6
6
  let(:config) { Fog::Brightbox::Config.new(settings) }
7
7
  let(:connection) { Fog::Brightbox::Storage::Connection.new(config) }
8
8
  let(:params) do
9
- { :path => "fnord", :expects => [200] }
9
+ { path: "fnord", expects: [200] }
10
10
  end
11
11
  let(:settings) do
12
12
  {
13
- :brightbox_client_id => "app-12345",
14
- :brightbox_secret => "1234567890",
15
- :brightbox_storage_management_url => "https://files.gb2.brightbox.com/v1/acc-12345"
13
+ brightbox_client_id: "app-12345",
14
+ brightbox_secret: "1234567890",
15
+ brightbox_storage_management_url: "https://files.gb2.brightbox.com/v1/acc-12345"
16
16
  }
17
17
  end
18
18
  let(:valid_auth_token) { "01234567890abcdefghijklmnopqrstuvwxyz" }
@@ -45,8 +45,8 @@ describe Fog::Brightbox::Storage::Connection do
45
45
  }.each do |status, error|
46
46
  describe "when request responds with #{status}" do
47
47
  it "raises #{error}" do
48
- stub_request(:get, "https://files.gb2.brightbox.com/v1/acc-12345/fnord").
49
- to_return(:status => status)
48
+ stub_request(:get, "https://files.gb2.brightbox.com/v1/acc-12345/fnord")
49
+ .to_return(status: status)
50
50
  assert_raises(error) { connection.request(params) }
51
51
  end
52
52
  end
@@ -6,13 +6,13 @@ describe Fog::Brightbox::Storage::Connection do
6
6
  let(:config) { Fog::Brightbox::Config.new(settings) }
7
7
  let(:connection) { Fog::Brightbox::Storage::Connection.new(config) }
8
8
  let(:params) do
9
- { :path => "fnord", :expects => [200] }
9
+ { path: "fnord", expects: [200] }
10
10
  end
11
11
  let(:settings) do
12
12
  {
13
- :brightbox_client_id => "app-12345",
14
- :brightbox_secret => "1234567890",
15
- :brightbox_storage_management_url => "https://files.gb2.brightbox.com/v1/acc-12345"
13
+ brightbox_client_id: "app-12345",
14
+ brightbox_secret: "1234567890",
15
+ brightbox_storage_management_url: "https://files.gb2.brightbox.com/v1/acc-12345"
16
16
  }
17
17
  end
18
18
  let(:valid_auth_token) { "01234567890abcdefghijklmnopqrstuvwxyz" }
@@ -20,8 +20,8 @@ describe Fog::Brightbox::Storage::Connection do
20
20
  describe "when management URL is not available" do
21
21
  let(:settings) do
22
22
  {
23
- :brightbox_client_id => "app-12345",
24
- :brightbox_secret => "1234567890"
23
+ brightbox_client_id: "app-12345",
24
+ brightbox_secret: "1234567890"
25
25
  }
26
26
  end
27
27
 
@@ -42,14 +42,14 @@ describe Fog::Brightbox::Storage::Connection do
42
42
  let(:params) { {} }
43
43
 
44
44
  before do
45
- stub_request(:get, "https://files.gb2.brightbox.com/v1/acc-12345").
46
- with(:headers => {
47
- "Accept" => "application/json",
48
- "Content-Type" => "application/json",
49
- "X-Auth-Token" => valid_auth_token
50
- }).to_return(:status => 200, :body => "{}", :headers => {
51
- "Content-Type" => "application/json"
52
- })
45
+ stub_request(:get, "https://files.gb2.brightbox.com/v1/acc-12345")
46
+ .with(headers: {
47
+ "Accept" => "application/json",
48
+ "Content-Type" => "application/json",
49
+ "X-Auth-Token" => valid_auth_token
50
+ }).to_return(status: 200, body: "{}", headers: {
51
+ "Content-Type" => "application/json"
52
+ })
53
53
  end
54
54
 
55
55
  it "completes successfully" do
@@ -62,14 +62,14 @@ describe Fog::Brightbox::Storage::Connection do
62
62
 
63
63
  describe "when request should succeed" do
64
64
  before do
65
- stub_request(:get, "https://files.gb2.brightbox.com/v1/acc-12345/fnord").
66
- with(:headers => {
67
- "Accept" => "application/json",
68
- "Content-Type" => "application/json",
69
- "X-Auth-Token" => valid_auth_token
70
- }).to_return(:status => 200, :body => "{}", :headers => {
71
- "Content-Type" => "application/json"
72
- })
65
+ stub_request(:get, "https://files.gb2.brightbox.com/v1/acc-12345/fnord")
66
+ .with(headers: {
67
+ "Accept" => "application/json",
68
+ "Content-Type" => "application/json",
69
+ "X-Auth-Token" => valid_auth_token
70
+ }).to_return(status: 200, body: "{}", headers: {
71
+ "Content-Type" => "application/json"
72
+ })
73
73
  end
74
74
 
75
75
  it "completes successfully" do
@@ -82,12 +82,12 @@ describe Fog::Brightbox::Storage::Connection do
82
82
 
83
83
  describe "when custom headers are passed" do
84
84
  let(:params) do
85
- { :headers => { "X-Test" => "present" }, :path => "fnord" }
85
+ { headers: { "X-Test" => "present" }, path: "fnord" }
86
86
  end
87
87
 
88
88
  it "completes successfully" do
89
- stub_request(:get, "https://files.gb2.brightbox.com/v1/acc-12345/fnord").
90
- with(:headers => { "X-Test" => "present" }).to_return(:status => 200)
89
+ stub_request(:get, "https://files.gb2.brightbox.com/v1/acc-12345/fnord")
90
+ .with(headers: { "X-Test" => "present" }).to_return(status: 200)
91
91
 
92
92
  connection.request(params)
93
93
  pass
@@ -96,24 +96,24 @@ describe Fog::Brightbox::Storage::Connection do
96
96
 
97
97
  describe "when container is not found" do
98
98
  it "raises Fog::Brightbox::Storage::NotFound" do
99
- stub_request(:get, "https://files.gb2.brightbox.com/v1/acc-12345/fnord").
100
- to_return(:status => 404,
101
- :body => "<html><h1>Not Found</h1><p>The resource could not be found.</p></html>",
102
- :headers => {
103
- "Content-Type" => "text/html"
104
- })
99
+ stub_request(:get, "https://files.gb2.brightbox.com/v1/acc-12345/fnord")
100
+ .to_return(status: 404,
101
+ body: "<html><h1>Not Found</h1><p>The resource could not be found.</p></html>",
102
+ headers: {
103
+ "Content-Type" => "text/html"
104
+ })
105
105
  assert_raises(Fog::Brightbox::Storage::NotFound) { connection.request(params) }
106
106
  end
107
107
  end
108
108
 
109
109
  describe "when request is not authenticated" do
110
110
  it "raises Fog::Brightbox::Storage::AuthenticationRequired" do
111
- stub_request(:get, "https://files.gb2.brightbox.com/v1/acc-12345/fnord").
112
- to_return(:status => 401,
113
- :body => "Authentication required",
114
- :headers => {
115
- "Content-Type" => "text/plain"
116
- })
111
+ stub_request(:get, "https://files.gb2.brightbox.com/v1/acc-12345/fnord")
112
+ .to_return(status: 401,
113
+ body: "Authentication required",
114
+ headers: {
115
+ "Content-Type" => "text/plain"
116
+ })
117
117
  assert_raises(Fog::Brightbox::Storage::AuthenticationRequired) { connection.request(params) }
118
118
  end
119
119
  end
@@ -11,19 +11,19 @@ describe Fog::Brightbox::Storage::Directory do
11
11
  describe ".create" do
12
12
  let(:settings) do
13
13
  {
14
- :brightbox_client_id => "cli-12345",
15
- :brightbox_secret => "fdkls"
14
+ brightbox_client_id: "cli-12345",
15
+ brightbox_secret: "fdkls"
16
16
  }
17
17
  end
18
18
  let(:read_permissions) { ".r:*" }
19
19
  let(:write_permissions) { "*:*" }
20
20
 
21
21
  before do
22
- stub_request(:get, "https://orbit.brightbox.com/v1").
23
- to_return(authorized_response)
22
+ stub_request(:get, "https://orbit.brightbox.com/v1")
23
+ .to_return(authorized_response)
24
24
 
25
- stub_request(:put, "https://orbit.brightbox.com/v1/acc-12345/container-name").
26
- to_return(status: 201)
25
+ stub_request(:put, "https://orbit.brightbox.com/v1/acc-12345/container-name")
26
+ .to_return(status: 201)
27
27
  end
28
28
 
29
29
  it do
@@ -7,9 +7,9 @@ describe Fog::Brightbox::Storage::Files do
7
7
  describe "#get_url" do
8
8
  before do
9
9
  @options = {
10
- :brightbox_client_id => "cli-12345",
11
- :brightbox_secret => "1234567890",
12
- :brightbox_storage_management_url => "https://management.url/v1/acc-12345"
10
+ brightbox_client_id: "cli-12345",
11
+ brightbox_secret: "1234567890",
12
+ brightbox_storage_management_url: "https://management.url/v1/acc-12345"
13
13
  }
14
14
  @service = Fog::Brightbox::Storage.new(@options)
15
15
  end
@@ -61,8 +61,8 @@ describe Fog::Brightbox::Storage::Files do
61
61
  describe "when no management URL" do
62
62
  before do
63
63
  @options = {
64
- :brightbox_client_id => "cli-12345",
65
- :brightbox_secret => "1234567890"
64
+ brightbox_client_id: "cli-12345",
65
+ brightbox_secret: "1234567890"
66
66
  }
67
67
  @service = Fog::Brightbox::Storage.new(@options)
68
68
  end
@@ -5,9 +5,9 @@ describe Fog::Brightbox::Storage do
5
5
  describe "when passed in configuration" do
6
6
  before do
7
7
  @options = {
8
- :brightbox_client_id => "cli-12345",
9
- :brightbox_secret => "1234567890",
10
- :brightbox_storage_management_url => "https://management.url/v1/acc-12345"
8
+ brightbox_client_id: "cli-12345",
9
+ brightbox_secret: "1234567890",
10
+ brightbox_storage_management_url: "https://management.url/v1/acc-12345"
11
11
  }
12
12
  @service = Fog::Brightbox::Storage.new(@options)
13
13
  end
@@ -21,8 +21,8 @@ describe Fog::Brightbox::Storage do
21
21
  describe "when unavailable" do
22
22
  before do
23
23
  @options = {
24
- :brightbox_client_id => "cli-12345",
25
- :brightbox_secret => "1234567890"
24
+ brightbox_client_id: "cli-12345",
25
+ brightbox_secret: "1234567890"
26
26
  }
27
27
  @service = Fog::Brightbox::Storage.new(@options)
28
28
  end