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
@@ -4,20 +4,26 @@ describe Fog::Brightbox::Compute do
4
4
  describe "when global config is available" do
5
5
  before do
6
6
  @arguments = {
7
- :brightbox_auth_url => "http://localhost",
8
- :brightbox_api_url => "http://localhost",
9
- :brightbox_client_id => "",
10
- :brightbox_secret => "",
11
- :brightbox_username => "",
12
- :brightbox_password => "",
13
- :brightbox_account => ""
7
+ brightbox_auth_url: "http://localhost",
8
+ brightbox_api_url: "http://localhost",
9
+ brightbox_client_id: "",
10
+ brightbox_secret: "",
11
+ brightbox_username: "",
12
+ brightbox_password: "",
13
+ brightbox_account: ""
14
14
  }
15
15
 
16
16
  @credential_guard = Minitest::Mock.new
17
+ # Stub for older versions of fog-core
17
18
  def @credential_guard.reject
18
19
  {}
19
20
  end
20
21
 
22
+ # Stub for newer versions of fog-core
23
+ def @credential_guard.select
24
+ {}
25
+ end
26
+
21
27
  Fog.stub :credentials, @credential_guard do
22
28
  @service = Fog::Brightbox::Compute.new(@arguments)
23
29
  end
@@ -49,8 +55,8 @@ describe Fog::Brightbox::Compute do
49
55
  describe "when created with a Config object" do
50
56
  it "does not error" do
51
57
  @options = {
52
- :brightbox_client_id => "cli-12345",
53
- :brightbox_secret => "1234567890"
58
+ brightbox_client_id: "cli-12345",
59
+ brightbox_secret: "1234567890"
54
60
  }
55
61
  @config = Fog::Brightbox::Config.new(@options)
56
62
  @service = Fog::Brightbox::Compute.new(@config)
@@ -59,7 +65,7 @@ describe Fog::Brightbox::Compute do
59
65
  end
60
66
 
61
67
  describe "when created with Config missing required settings" do
62
- it "raises ArgumentError"do
68
+ it "raises ArgumentError" do
63
69
  @config = Fog::Brightbox::Config.new({})
64
70
  assert_raises ArgumentError do
65
71
  @service = Fog::Brightbox::Compute.new(@config)
@@ -19,8 +19,8 @@ describe Fog::Brightbox::Storage do
19
19
  describe "when created with a Config object" do
20
20
  let(:settings) do
21
21
  {
22
- :brightbox_client_id => "cli-12345",
23
- :brightbox_secret => "1234567890"
22
+ brightbox_client_id: "cli-12345",
23
+ brightbox_secret: "1234567890"
24
24
  }
25
25
  end
26
26
 
@@ -43,14 +43,14 @@ describe Fog::Brightbox::Storage do
43
43
  describe "when created with a viable config" do
44
44
  let(:settings) do
45
45
  {
46
- :brightbox_client_id => "cli-12345",
47
- :brightbox_secret => "fdkls"
46
+ brightbox_client_id: "cli-12345",
47
+ brightbox_secret: "fdkls"
48
48
  }
49
49
  end
50
50
 
51
51
  before do
52
- stub_request(:get, "https://orbit.brightbox.com/v1").
53
- to_return(authorized_response)
52
+ stub_request(:get, "https://orbit.brightbox.com/v1")
53
+ .to_return(authorized_response)
54
54
  end
55
55
 
56
56
  it "requires a call to authenticate" do
@@ -70,14 +70,14 @@ describe Fog::Brightbox::Storage do
70
70
  describe "when created with bad credentials" do
71
71
  let(:settings) do
72
72
  {
73
- :brightbox_client_id => "cli-12345",
74
- :brightbox_secret => "wrong"
73
+ brightbox_client_id: "cli-12345",
74
+ brightbox_secret: "wrong"
75
75
  }
76
76
  end
77
77
 
78
78
  it "fails to authenticate" do
79
- stub_request(:get, "https://orbit.brightbox.com/v1").
80
- to_return(unauthorized_response)
79
+ stub_request(:get, "https://orbit.brightbox.com/v1")
80
+ .to_return(unauthorized_response)
81
81
 
82
82
  assert_raises(Fog::Brightbox::Storage::AuthenticationRequired) { service.authenticate }
83
83
  assert_nil service.management_url
@@ -87,17 +87,17 @@ describe Fog::Brightbox::Storage do
87
87
  describe "when configured scoped to a specific account" do
88
88
  let(:settings) do
89
89
  {
90
- :brightbox_client_id => "app-12345",
91
- :brightbox_secret => "12345",
92
- :brightbox_username => "user@example.test",
93
- :brightbox_password => "abcde",
94
- :brightbox_account => "acc-abcde"
90
+ brightbox_client_id: "app-12345",
91
+ brightbox_secret: "12345",
92
+ brightbox_username: "user@example.test",
93
+ brightbox_password: "abcde",
94
+ brightbox_account: "acc-abcde"
95
95
  }
96
96
  end
97
97
 
98
98
  before do
99
- stub_request(:get, "https://orbit.brightbox.com/v1").
100
- to_return(authorized_response)
99
+ stub_request(:get, "https://orbit.brightbox.com/v1")
100
+ .to_return(authorized_response)
101
101
  end
102
102
 
103
103
  it "uses the configured account" do
@@ -109,16 +109,16 @@ describe Fog::Brightbox::Storage do
109
109
  describe "when account is not configured" do
110
110
  let(:settings) do
111
111
  {
112
- :brightbox_client_id => "app-12345",
113
- :brightbox_secret => "12345",
114
- :brightbox_username => "user@example.test",
115
- :brightbox_password => "abcde"
112
+ brightbox_client_id: "app-12345",
113
+ brightbox_secret: "12345",
114
+ brightbox_username: "user@example.test",
115
+ brightbox_password: "abcde"
116
116
  }
117
117
  end
118
118
 
119
119
  before do
120
- stub_request(:get, "https://orbit.brightbox.com/v1").
121
- to_return(authorized_response)
120
+ stub_request(:get, "https://orbit.brightbox.com/v1")
121
+ .to_return(authorized_response)
122
122
  end
123
123
 
124
124
  it "extracts the account from the management URL" do
@@ -130,10 +130,10 @@ describe Fog::Brightbox::Storage do
130
130
  describe "when configured with existing token" do
131
131
  let(:settings) do
132
132
  {
133
- :brightbox_client_id => "app-12345",
134
- :brightbox_secret => "12345",
135
- :brightbox_access_token => "1234567890abcdefghijklmnopqrstuvwxyz",
136
- :brightbox_refresh_token => "1234567890abcdefghijklmnopqrstuvwxyz"
133
+ brightbox_client_id: "app-12345",
134
+ brightbox_secret: "12345",
135
+ brightbox_access_token: "1234567890abcdefghijklmnopqrstuvwxyz",
136
+ brightbox_refresh_token: "1234567890abcdefghijklmnopqrstuvwxyz"
137
137
  }
138
138
  end
139
139
 
@@ -149,11 +149,11 @@ describe Fog::Brightbox::Storage do
149
149
  describe "when configured with tokens and management_url" do
150
150
  let(:settings) do
151
151
  {
152
- :brightbox_client_id => "app-12345",
153
- :brightbox_secret => "12345",
154
- :brightbox_access_token => "1234567890abcdefghijklmnopqrstuvwxyz",
155
- :brightbox_refresh_token => "1234567890abcdefghijklmnopqrstuvwxyz",
156
- :brightbox_storage_management_url => "https://files.gb2.brightbox.com/v1/acc-12345"
152
+ brightbox_client_id: "app-12345",
153
+ brightbox_secret: "12345",
154
+ brightbox_access_token: "1234567890abcdefghijklmnopqrstuvwxyz",
155
+ brightbox_refresh_token: "1234567890abcdefghijklmnopqrstuvwxyz",
156
+ brightbox_storage_management_url: "https://files.gb2.brightbox.com/v1/acc-12345"
157
157
  }
158
158
  end
159
159
 
@@ -166,8 +166,8 @@ describe Fog::Brightbox::Storage do
166
166
  end
167
167
 
168
168
  it "keeps setting after authentication" do
169
- stub_request(:get, "https://orbit.brightbox.com/v1").
170
- to_return(authorized_response)
169
+ stub_request(:get, "https://orbit.brightbox.com/v1")
170
+ .to_return(authorized_response)
171
171
  config.expire_tokens!
172
172
  service.authenticate
173
173
  assert_equal "https://files.gb2.brightbox.com/v1/acc-12345", service.management_url.to_s
@@ -177,22 +177,22 @@ describe Fog::Brightbox::Storage do
177
177
  describe "when configured with expired tokens" do
178
178
  let(:settings) do
179
179
  {
180
- :brightbox_client_id => "app-12345",
181
- :brightbox_secret => "12345",
182
- :brightbox_access_token => "1234567890abcdefghijklmnopqrstuvwxyz",
183
- :brightbox_refresh_token => "1234567890abcdefghijklmnopqrstuvwxyz",
184
- :brightbox_storage_management_url => "https://files.gb2.brightbox.com/v1/acc-12345",
185
- :brightbox_token_management => false
180
+ brightbox_client_id: "app-12345",
181
+ brightbox_secret: "12345",
182
+ brightbox_access_token: "1234567890abcdefghijklmnopqrstuvwxyz",
183
+ brightbox_refresh_token: "1234567890abcdefghijklmnopqrstuvwxyz",
184
+ brightbox_storage_management_url: "https://files.gb2.brightbox.com/v1/acc-12345",
185
+ brightbox_token_management: false
186
186
  }
187
187
  end
188
188
 
189
189
  before do
190
190
  # Ongoing request but tokens are expired
191
- stub_request(:get, "https://files.gb2.brightbox.com/v1/acc-12345/fnord").
192
- to_return(unauthorized_response)
191
+ stub_request(:get, "https://files.gb2.brightbox.com/v1/acc-12345/fnord")
192
+ .to_return(unauthorized_response)
193
193
  end
194
194
 
195
- let(:params) { { :expects => [200], :path => "fnord" } }
195
+ let(:params) { { expects: [200], path: "fnord" } }
196
196
 
197
197
  it "raises Fog::Brightbox::Storage::AuthenticationRequired" do
198
198
  assert_raises(Fog::Brightbox::Storage::AuthenticationRequired) { service.request(params) }
@@ -202,35 +202,35 @@ describe Fog::Brightbox::Storage do
202
202
  describe "when configured with user details and expired tokens" do
203
203
  let(:settings) do
204
204
  {
205
- :brightbox_client_id => "app-12345",
206
- :brightbox_secret => "12345",
207
- :brightbox_username => "user@example.test",
208
- :brightbox_password => "12345",
209
- :brightbox_access_token => "1234567890abcdefghijklmnopqrstuvwxyz",
210
- :brightbox_refresh_token => "1234567890abcdefghijklmnopqrstuvwxyz",
211
- :brightbox_storage_url => "https://files.gb2.brightbox.com",
212
- :brightbox_storage_management_url => "https://files.gb2.brightbox.com/v1/acc-12345"
205
+ brightbox_client_id: "app-12345",
206
+ brightbox_secret: "12345",
207
+ brightbox_username: "user@example.test",
208
+ brightbox_password: "12345",
209
+ brightbox_access_token: "1234567890abcdefghijklmnopqrstuvwxyz",
210
+ brightbox_refresh_token: "1234567890abcdefghijklmnopqrstuvwxyz",
211
+ brightbox_storage_url: "https://files.gb2.brightbox.com",
212
+ brightbox_storage_management_url: "https://files.gb2.brightbox.com/v1/acc-12345"
213
213
  }
214
214
  end
215
215
 
216
216
  before do
217
217
  # Ongoing request but tokens are expired
218
- stub_request(:get, "https://files.gb2.brightbox.com/v1/acc-12345/fnord").
219
- with(:headers => { "X-Auth-Token" => "1234567890abcdefghijklmnopqrstuvwxyz" }).
220
- to_return(unauthorized_response)
218
+ stub_request(:get, "https://files.gb2.brightbox.com/v1/acc-12345/fnord")
219
+ .with(headers: { "X-Auth-Token" => "1234567890abcdefghijklmnopqrstuvwxyz" })
220
+ .to_return(unauthorized_response)
221
221
 
222
222
  # The reauthentication
223
- stub_request(:get, "https://files.gb2.brightbox.com/v1").
224
- with(:headers => { "X-Auth-User" => "user@example.test", "X-Auth-Key" => "12345" }).
225
- to_return(authorized_response)
223
+ stub_request(:get, "https://files.gb2.brightbox.com/v1")
224
+ .with(headers: { "X-Auth-User" => "user@example.test", "X-Auth-Key" => "12345" })
225
+ .to_return(authorized_response)
226
226
 
227
227
  # Repeated request
228
- stub_request(:get, "https://files.gb2.brightbox.com/v1/acc-12345/fnord").
229
- with(:headers => { "X-Auth-Token" => "abcdefghijklmnopqrstuvwxyz1234567890" }).
230
- to_return(:status => 200)
228
+ stub_request(:get, "https://files.gb2.brightbox.com/v1/acc-12345/fnord")
229
+ .with(headers: { "X-Auth-Token" => "abcdefghijklmnopqrstuvwxyz1234567890" })
230
+ .to_return(status: 200)
231
231
  end
232
232
 
233
- let(:params) { { :expects => [200], :path => "fnord" } }
233
+ let(:params) { { expects: [200], path: "fnord" } }
234
234
 
235
235
  it "authenticates again and retries" do
236
236
  service.request(params)
@@ -241,23 +241,23 @@ describe Fog::Brightbox::Storage do
241
241
  describe "when configured with client credentials" do
242
242
  let(:settings) do
243
243
  {
244
- :brightbox_client_id => "cli-12345",
245
- :brightbox_secret => "12345"
244
+ brightbox_client_id: "cli-12345",
245
+ brightbox_secret: "12345"
246
246
  }
247
247
  end
248
248
 
249
249
  before do
250
250
  # Initial authentication
251
- stub_request(:get, "https://orbit.brightbox.com/v1").
252
- with(:headers => { "X-Auth-Key" => "12345", "X-Auth-User" => "cli-12345" }).
253
- to_return(authorized_response)
251
+ stub_request(:get, "https://orbit.brightbox.com/v1")
252
+ .with(headers: { "X-Auth-Key" => "12345", "X-Auth-User" => "cli-12345" })
253
+ .to_return(authorized_response)
254
254
 
255
- stub_request(:get, "https://orbit.brightbox.com/v1/acc-12345/fnord").
256
- with(:headers => { "X-Auth-Token" => "abcdefghijklmnopqrstuvwxyz1234567890" }).
257
- to_return(:status => 200)
255
+ stub_request(:get, "https://orbit.brightbox.com/v1/acc-12345/fnord")
256
+ .with(headers: { "X-Auth-Token" => "abcdefghijklmnopqrstuvwxyz1234567890" })
257
+ .to_return(status: 200)
258
258
  end
259
259
 
260
- let(:params) { { :expects => [200], :path => "fnord" } }
260
+ let(:params) { { expects: [200], path: "fnord" } }
261
261
 
262
262
  it "authenticates again and retries" do
263
263
  service.request(params)
@@ -268,8 +268,8 @@ describe Fog::Brightbox::Storage do
268
268
  describe "when not initialised with temporary URL key" do
269
269
  let(:settings) do
270
270
  {
271
- :brightbox_client_id => "cli-12345",
272
- :brightbox_secret => "12345"
271
+ brightbox_client_id: "cli-12345",
272
+ brightbox_secret: "12345"
273
273
  }
274
274
  end
275
275
 
@@ -286,10 +286,10 @@ describe Fog::Brightbox::Storage do
286
286
  let(:temp_url_key) { "1234567890" }
287
287
  let(:settings) do
288
288
  {
289
- :brightbox_client_id => "cli-12345",
290
- :brightbox_secret => "12345",
291
- :brightbox_storage_management_url => "https://example.brightbox.com",
292
- :brightbox_temp_url_key => temp_url_key
289
+ brightbox_client_id: "cli-12345",
290
+ brightbox_secret: "12345",
291
+ brightbox_storage_management_url: "https://example.brightbox.com",
292
+ brightbox_temp_url_key: temp_url_key
293
293
  }
294
294
  end
295
295
  let(:container) { "container" }
@@ -303,17 +303,17 @@ describe Fog::Brightbox::Storage do
303
303
 
304
304
  it "can generate temporary HTTPS URLs" do
305
305
  assert_equal "https://example.brightbox.com/container/file.ext?temp_url_sig=86dcfd2cf9d501936abab2badc152e90d6b3b133&temp_url_expires=1325376000",
306
- service.create_temp_url(container, object, expiry_time, request_method, :scheme => "https")
306
+ service.create_temp_url(container, object, expiry_time, request_method, scheme: "https")
307
307
  end
308
308
 
309
309
  it "can generate temporary HTTP URLs" do
310
310
  assert_equal "http://example.brightbox.com/container/file.ext?temp_url_sig=86dcfd2cf9d501936abab2badc152e90d6b3b133&temp_url_expires=1325376000",
311
- service.create_temp_url(container, object, expiry_time, request_method, :scheme => "http")
311
+ service.create_temp_url(container, object, expiry_time, request_method, scheme: "http")
312
312
  end
313
313
 
314
314
  it "can generate temporary HTTP URLs on non standard ports" do
315
315
  assert_equal "http://example.brightbox.com:401/container/file.ext?temp_url_sig=86dcfd2cf9d501936abab2badc152e90d6b3b133&temp_url_expires=1325376000",
316
- service.create_temp_url(container, object, expiry_time, request_method, :scheme => "http", :port => 401)
316
+ service.create_temp_url(container, object, expiry_time, request_method, scheme: "http", port: 401)
317
317
  end
318
318
  end
319
319
 
@@ -321,9 +321,9 @@ describe Fog::Brightbox::Storage do
321
321
  let(:temp_url_key) { "1234567890" }
322
322
  let(:settings) do
323
323
  {
324
- :brightbox_client_id => "cli-12345",
325
- :brightbox_secret => "12345",
326
- :brightbox_temp_url_key => temp_url_key
324
+ brightbox_client_id: "cli-12345",
325
+ brightbox_secret: "12345",
326
+ brightbox_temp_url_key: temp_url_key
327
327
  }
328
328
  end
329
329
  let(:container) { "container" }
@@ -333,7 +333,7 @@ describe Fog::Brightbox::Storage do
333
333
 
334
334
  it "raises an error" do
335
335
  assert_raises Fog::Brightbox::Storage::ManagementUrlUnknown do
336
- service.create_temp_url(container, object, expiry_time, request_method, :scheme => "https")
336
+ service.create_temp_url(container, object, expiry_time, request_method, scheme: "https")
337
337
  end
338
338
  end
339
339
  end
data/spec/model_setup.rb CHANGED
@@ -3,15 +3,15 @@ module ModelSetup
3
3
  base.class_eval do
4
4
  let(:configuration) do
5
5
  {
6
- :brightbox_auth_url => "http://localhost",
7
- :brightbox_api_url => "http://localhost",
8
- :brightbox_client_id => "",
9
- :brightbox_secret => "",
10
- :brightbox_username => "",
11
- :brightbox_password => "",
12
- :brightbox_account => "",
13
- :brightbox_default_image => "img-test",
14
- :brightbox_access_token => "FAKECACHEDTOKEN"
6
+ brightbox_auth_url: "http://localhost",
7
+ brightbox_api_url: "http://localhost",
8
+ brightbox_client_id: "",
9
+ brightbox_secret: "",
10
+ brightbox_username: "",
11
+ brightbox_password: "",
12
+ brightbox_account: "",
13
+ brightbox_default_image: "img-test",
14
+ brightbox_access_token: "FAKECACHEDTOKEN"
15
15
  }
16
16
  end
17
17
 
@@ -1,9 +1,9 @@
1
1
  module StockStorageResponses
2
2
  def authorized_response
3
3
  {
4
- :status => 200,
5
- :body => "Authenticated",
6
- :headers => {
4
+ status: 200,
5
+ body: "Authenticated",
6
+ headers: {
7
7
  "X-Storage-Url" => "https://orbit.brightbox.com/v1/acc-12345",
8
8
  "X-Storage-Token" => "abcdefghijklmnopqrstuvwxyz1234567890",
9
9
  "X-Auth-Token" => "abcdefghijklmnopqrstuvwxyz1234567890",
@@ -14,9 +14,9 @@ module StockStorageResponses
14
14
 
15
15
  def unauthorized_response
16
16
  {
17
- :status => 401,
18
- :body => "<html><h1>Unauthorized</h1><p>This server could not verify that you are authorized to access the document you requested.</p></html>",
19
- :headers => {
17
+ status: 401,
18
+ body: "<html><h1>Unauthorized</h1><p>This server could not verify that you are authorized to access the document you requested.</p></html>",
19
+ headers: {
20
20
  "Content-Length" => 131,
21
21
  "Content-Type" => "text/html; charset=UTF-8"
22
22
  }
@@ -25,9 +25,9 @@ module StockStorageResponses
25
25
 
26
26
  def bad_url_response
27
27
  {
28
- :status => 412,
29
- :body => "Bad URL",
30
- :headers => {
28
+ status: 412,
29
+ body: "Bad URL",
30
+ headers: {
31
31
  "Content-Length" => 7,
32
32
  "Content-Type" => "text/html; charset=UTF-8"
33
33
  }
@@ -16,9 +16,9 @@ module SupportsResourceLocking
16
16
  def test_lock_makes_request
17
17
  subject.id = "tst-12345"
18
18
 
19
- stub_request(:put, "http://localhost/1.0/#{collection_name}/tst-12345/lock_resource").
20
- with(:query => hash_including(:account_id)).
21
- to_return(:status => 200, :body => "{}", :headers => {})
19
+ stub_request(:put, "http://localhost/1.0/#{collection_name}/tst-12345/lock_resource")
20
+ .with(query: hash_including(:account_id))
21
+ .to_return(status: 200, body: "{}", headers: {})
22
22
 
23
23
  subject.lock!
24
24
  end
@@ -30,9 +30,9 @@ module SupportsResourceLocking
30
30
  def test_unlock_makes_request
31
31
  subject.id = "tst-12345"
32
32
 
33
- stub_request(:put, "http://localhost/1.0/#{collection_name}/tst-12345/unlock_resource").
34
- with(:query => hash_including(:account_id)).
35
- to_return(:status => 200, :body => "{}", :headers => {})
33
+ stub_request(:put, "http://localhost/1.0/#{collection_name}/tst-12345/unlock_resource")
34
+ .with(query: hash_including(:account_id))
35
+ .to_return(status: 200, body: "{}", headers: {})
36
36
 
37
37
  subject.unlock!
38
38
  end