fog-brightbox 1.10.0 → 1.11.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.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +15 -10
  3. data/CHANGELOG.md +17 -0
  4. data/Rakefile +1 -1
  5. data/fog-brightbox.gemspec +5 -3
  6. data/lib/fog/brightbox/compute/shared.rb +11 -10
  7. data/lib/fog/brightbox/compute.rb +20 -21
  8. data/lib/fog/brightbox/config.rb +6 -9
  9. data/lib/fog/brightbox/models/compute/api_client.rb +4 -4
  10. data/lib/fog/brightbox/models/compute/application.rb +2 -2
  11. data/lib/fog/brightbox/models/compute/cloud_ip.rb +11 -11
  12. data/lib/fog/brightbox/models/compute/collaboration.rb +3 -3
  13. data/lib/fog/brightbox/models/compute/collaborations.rb +1 -1
  14. data/lib/fog/brightbox/models/compute/config_map.rb +2 -3
  15. data/lib/fog/brightbox/models/compute/database_server.rb +17 -5
  16. data/lib/fog/brightbox/models/compute/database_snapshot.rb +2 -2
  17. data/lib/fog/brightbox/models/compute/firewall_policy.rb +6 -6
  18. data/lib/fog/brightbox/models/compute/firewall_rule.rb +9 -9
  19. data/lib/fog/brightbox/models/compute/image.rb +9 -9
  20. data/lib/fog/brightbox/models/compute/load_balancer.rb +12 -12
  21. data/lib/fog/brightbox/models/compute/server.rb +21 -23
  22. data/lib/fog/brightbox/models/compute/server_group.rb +6 -6
  23. data/lib/fog/brightbox/models/compute/user.rb +3 -3
  24. data/lib/fog/brightbox/models/compute/volume.rb +16 -16
  25. data/lib/fog/brightbox/models/storage/directories.rb +2 -2
  26. data/lib/fog/brightbox/models/storage/directory.rb +7 -7
  27. data/lib/fog/brightbox/models/storage/file.rb +13 -13
  28. data/lib/fog/brightbox/models/storage/files.rb +9 -13
  29. data/lib/fog/brightbox/oauth2.rb +11 -11
  30. data/lib/fog/brightbox/requests/compute/list_accounts.rb +1 -1
  31. data/lib/fog/brightbox/requests/compute/reset_database_server.rb +21 -0
  32. data/lib/fog/brightbox/requests/compute/resize_database_server.rb +25 -0
  33. data/lib/fog/brightbox/requests/compute/snapshot_database_server.rb +1 -1
  34. data/lib/fog/brightbox/requests/compute/snapshot_server.rb +1 -1
  35. data/lib/fog/brightbox/requests/storage/copy_object.rb +5 -5
  36. data/lib/fog/brightbox/requests/storage/delete_container.rb +3 -3
  37. data/lib/fog/brightbox/requests/storage/delete_multiple_objects.rb +7 -7
  38. data/lib/fog/brightbox/requests/storage/delete_object.rb +3 -3
  39. data/lib/fog/brightbox/requests/storage/delete_static_large_object.rb +6 -6
  40. data/lib/fog/brightbox/requests/storage/get_container.rb +4 -4
  41. data/lib/fog/brightbox/requests/storage/get_containers.rb +4 -4
  42. data/lib/fog/brightbox/requests/storage/get_object.rb +4 -6
  43. data/lib/fog/brightbox/requests/storage/get_object_http_url.rb +1 -1
  44. data/lib/fog/brightbox/requests/storage/get_object_https_url.rb +1 -1
  45. data/lib/fog/brightbox/requests/storage/head_container.rb +4 -4
  46. data/lib/fog/brightbox/requests/storage/head_containers.rb +4 -4
  47. data/lib/fog/brightbox/requests/storage/head_object.rb +3 -3
  48. data/lib/fog/brightbox/requests/storage/post_set_meta_temp_url_key.rb +3 -3
  49. data/lib/fog/brightbox/requests/storage/put_container.rb +4 -4
  50. data/lib/fog/brightbox/requests/storage/put_dynamic_obj_manifest.rb +4 -4
  51. data/lib/fog/brightbox/requests/storage/put_object.rb +7 -7
  52. data/lib/fog/brightbox/requests/storage/put_static_obj_manifest.rb +6 -6
  53. data/lib/fog/brightbox/storage/authentication_request.rb +4 -4
  54. data/lib/fog/brightbox/storage/connection.rb +2 -2
  55. data/lib/fog/brightbox/storage.rb +13 -14
  56. data/lib/fog/brightbox/version.rb +1 -1
  57. data/spec/fog/brightbox/compute/config_spec.rb +4 -4
  58. data/spec/fog/brightbox/compute/get_access_token_spec.rb +28 -28
  59. data/spec/fog/brightbox/compute/wrapped_request_spec.rb +23 -23
  60. data/spec/fog/brightbox/config_spec.rb +23 -23
  61. data/spec/fog/brightbox/oauth2/client_credentials_strategy_spec.rb +2 -2
  62. data/spec/fog/brightbox/oauth2/credential_set_spec.rb +5 -5
  63. data/spec/fog/brightbox/oauth2/grant_type_strategy_spec.rb +2 -2
  64. data/spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb +3 -3
  65. data/spec/fog/brightbox/oauth2/user_credentials_strategy_spec.rb +4 -4
  66. data/spec/fog/brightbox/storage/authentication_request_spec.rb +34 -34
  67. data/spec/fog/brightbox/storage/config_spec.rb +4 -4
  68. data/spec/fog/brightbox/storage/connection_errors_spec.rb +6 -6
  69. data/spec/fog/brightbox/storage/connection_spec.rb +37 -37
  70. data/spec/fog/brightbox/storage/directory_spec.rb +6 -6
  71. data/spec/fog/brightbox/storage/files_spec.rb +5 -5
  72. data/spec/fog/brightbox/storage_spec.rb +5 -5
  73. data/spec/fog/compute/brightbox/database_server_spec.rb +19 -19
  74. data/spec/fog/compute/brightbox/image_selector_spec.rb +18 -18
  75. data/spec/fog/compute/brightbox/load_balancer_spec.rb +5 -5
  76. data/spec/fog/compute/brightbox/server_spec.rb +44 -44
  77. data/spec/fog/compute/brightbox/volume_spec.rb +68 -69
  78. data/spec/fog/compute/brightbox_spec.rb +10 -10
  79. data/spec/fog/storage/brightbox_spec.rb +83 -83
  80. data/spec/model_setup.rb +9 -9
  81. data/spec/stock_storage_responses.rb +9 -9
  82. data/spec/supports_resource_locking.rb +6 -6
  83. data/tests/brightbox/compute/schema.rb +74 -74
  84. data/tests/brightbox/compute_tests.rb +14 -14
  85. data/tests/brightbox/models/compute/server_tests.rb +0 -1
  86. data/tests/brightbox/requests/compute/account_tests.rb +9 -9
  87. data/tests/brightbox/requests/compute/api_client_tests.rb +9 -9
  88. data/tests/brightbox/requests/compute/application_test.rb +8 -8
  89. data/tests/brightbox/requests/compute/cloud_ip_tests.rb +11 -13
  90. data/tests/brightbox/requests/compute/collaboration_tests.rb +1 -1
  91. data/tests/brightbox/requests/compute/database_server_tests.rb +7 -7
  92. data/tests/brightbox/requests/compute/database_snapsnot_tests.rb +5 -5
  93. data/tests/brightbox/requests/compute/database_type_tests.rb +1 -1
  94. data/tests/brightbox/requests/compute/firewall_policy_tests.rb +7 -7
  95. data/tests/brightbox/requests/compute/firewall_rule_tests.rb +8 -10
  96. data/tests/brightbox/requests/compute/helper.rb +1 -1
  97. data/tests/brightbox/requests/compute/image_tests.rb +2 -2
  98. data/tests/brightbox/requests/compute/interface_tests.rb +1 -1
  99. data/tests/brightbox/requests/compute/load_balancer_tests.rb +23 -23
  100. data/tests/brightbox/requests/compute/server_group_tests.rb +16 -18
  101. data/tests/brightbox/requests/compute/server_tests.rb +12 -12
  102. data/tests/brightbox/requests/compute/server_type_tests.rb +2 -2
  103. data/tests/brightbox/requests/compute/user_tests.rb +4 -4
  104. data/tests/brightbox/requests/compute/volume_tests.rb +5 -5
  105. data/tests/brightbox/requests/compute/zone_tests.rb +2 -2
  106. data/tests/helper.rb +1 -1
  107. data/tests/helpers/collection_helper.rb +16 -23
  108. data/tests/helpers/compute/server_helper.rb +4 -6
  109. data/tests/helpers/formats_helper.rb +5 -5
  110. data/tests/helpers/formats_helper_tests.rb +16 -16
  111. data/tests/helpers/mock_helper.rb +84 -86
  112. data/tests/helpers/model_helper.rb +1 -3
  113. data/tests/helpers/schema_validator_tests.rb +14 -14
  114. metadata +17 -2
  115. data/.rubocop_todo.yml +0 -81
@@ -7,9 +7,9 @@ Shindo.tests("Fog::Compute[:brightbox] | server requests", ["brightbox"]) do
7
7
 
8
8
  tests("#create_server(:image => '#{image_id}')") do
9
9
  pending if Fog.mocking?
10
- result = Fog::Compute[:brightbox].create_server(:image => image_id)
10
+ result = Fog::Compute[:brightbox].create_server(image: image_id)
11
11
  server_id = result["id"]
12
- data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, :allow_extra_keys => true) { result }
12
+ data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, allow_extra_keys: true) { result }
13
13
  end
14
14
 
15
15
  unless Fog.mocking?
@@ -19,25 +19,25 @@ Shindo.tests("Fog::Compute[:brightbox] | server requests", ["brightbox"]) do
19
19
  tests("#list_servers") do
20
20
  pending if Fog.mocking?
21
21
  result = Fog::Compute[:brightbox].list_servers
22
- data_matches_schema(Brightbox::Compute::Formats::Collection::SERVERS, :allow_extra_keys => true) { result }
22
+ data_matches_schema(Brightbox::Compute::Formats::Collection::SERVERS, allow_extra_keys: true) { result }
23
23
  end
24
24
 
25
25
  tests("#get_server('#{server_id}')") do
26
26
  pending if Fog.mocking?
27
27
  result = Fog::Compute[:brightbox].get_server(server_id)
28
- data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, :allow_extra_keys => true) { result }
28
+ data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, allow_extra_keys: true) { result }
29
29
  end
30
30
 
31
31
  tests("#update_server('#{server_id}')") do
32
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 }
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
35
  end
36
36
 
37
37
  tests("#activate_console_server('#{server_id}')") do
38
38
  pending if Fog.mocking?
39
39
  result = Fog::Compute[:brightbox].activate_console_server(server_id)
40
- data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, :allow_extra_keys => true) { result }
40
+ data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, allow_extra_keys: true) { result }
41
41
  test("has set 'console_url'") { !result["console_url"].empty? }
42
42
  test("has set 'console_token'") { !result["console_token"].empty? }
43
43
  test("has set 'console_token_expires'") { !result["console_token_expires"].empty? }
@@ -46,13 +46,13 @@ Shindo.tests("Fog::Compute[:brightbox] | server requests", ["brightbox"]) do
46
46
  tests("#stop_server('#{server_id}')") do
47
47
  pending if Fog.mocking?
48
48
  result = Fog::Compute[:brightbox].stop_server(server_id)
49
- data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, :allow_extra_keys => true) { result }
49
+ data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, allow_extra_keys: true) { result }
50
50
  end
51
51
 
52
52
  tests("#start_server('#{server_id}')") do
53
53
  pending if Fog.mocking?
54
54
  result = Fog::Compute[:brightbox].start_server(server_id)
55
- data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, :allow_extra_keys => true) { result }
55
+ data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, allow_extra_keys: true) { result }
56
56
  end
57
57
 
58
58
  unless Fog.mocking?
@@ -62,13 +62,13 @@ Shindo.tests("Fog::Compute[:brightbox] | server requests", ["brightbox"]) do
62
62
  tests("#shutdown_server('#{server_id}')") do
63
63
  pending if Fog.mocking?
64
64
  result = Fog::Compute[:brightbox].shutdown_server(server_id)
65
- data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, :allow_extra_keys => true) { result }
65
+ data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, allow_extra_keys: true) { result }
66
66
  end
67
67
 
68
68
  tests("#snapshot_server('#{server_id}')") do
69
69
  pending if Fog.mocking?
70
70
  result = Fog::Compute[:brightbox].snapshot_server(server_id)
71
- data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, :allow_extra_keys => true) { result }
71
+ data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, allow_extra_keys: true) { result }
72
72
  # Server should be exclusively for our test so assume we can delete the snapshot
73
73
  snapshot_id = result["snapshots"].first["id"]
74
74
  @snapshot = Fog::Compute[:brightbox].images.get(snapshot_id)
@@ -79,7 +79,7 @@ Shindo.tests("Fog::Compute[:brightbox] | server requests", ["brightbox"]) do
79
79
  tests("#delete_server('#{server_id}')") do
80
80
  pending if Fog.mocking?
81
81
  result = Fog::Compute[:brightbox].delete_server(server_id)
82
- data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, :allow_extra_keys => true) { result }
82
+ data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, allow_extra_keys: true) { result }
83
83
  end
84
84
  end
85
85
 
@@ -4,13 +4,13 @@ Shindo.tests("Fog::Compute[:brightbox] | server type requests", ["brightbox"]) d
4
4
  pending if Fog.mocking?
5
5
  result = Fog::Compute[:brightbox].list_server_types
6
6
  @server_type_id = result.first["id"]
7
- data_matches_schema(Brightbox::Compute::Formats::Collection::SERVER_TYPES, :allow_extra_keys => true) { result }
7
+ data_matches_schema(Brightbox::Compute::Formats::Collection::SERVER_TYPES, allow_extra_keys: true) { result }
8
8
  end
9
9
 
10
10
  tests("#get_server_type('#{@server_type_id}')") do
11
11
  pending if Fog.mocking?
12
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 }
13
+ data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_TYPE, allow_extra_keys: true) { result }
14
14
  end
15
15
  end
16
16
 
@@ -4,22 +4,22 @@ Shindo.tests("Fog::Compute[:brightbox] | user requests", ["brightbox"]) do
4
4
  pending if Fog.mocking?
5
5
  result = Fog::Compute[:brightbox].list_users
6
6
  @user_id = result.first["id"]
7
- data_matches_schema(Brightbox::Compute::Formats::Collection::USERS, :allow_extra_keys => true) { result }
7
+ data_matches_schema(Brightbox::Compute::Formats::Collection::USERS, allow_extra_keys: true) { result }
8
8
  end
9
9
 
10
10
  tests("#get_user('#{@user_id}')") do
11
11
  pending if Fog.mocking?
12
12
  result = Fog::Compute[:brightbox].get_user(@user_id)
13
13
  @current_name = result["name"]
14
- data_matches_schema(Brightbox::Compute::Formats::Full::USER, :allow_extra_keys => true) { result }
14
+ data_matches_schema(Brightbox::Compute::Formats::Full::USER, allow_extra_keys: true) { result }
15
15
  end
16
16
 
17
17
  # Rather than setting the name to something useless we set it to the original value
18
- update_options = { :name => @current_name }
18
+ update_options = { name: @current_name }
19
19
  tests("#update_user('#{@user_id}', #{update_options.inspect})") do
20
20
  pending if Fog.mocking?
21
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 }
22
+ data_matches_schema(Brightbox::Compute::Formats::Full::USER, allow_extra_keys: true) { result }
23
23
  end
24
24
  end
25
25
 
@@ -8,12 +8,12 @@ Shindo.tests("Fog::Compute[:brightbox] | volume requests", ["brightbox"]) do
8
8
  tests("#create_volume(#{create_options.inspect})") do
9
9
  result = Fog::Compute[:brightbox].create_volume(create_options)
10
10
  @volume_id = result["id"]
11
- data_matches_schema(Brightbox::Compute::Formats::Full::VOLUME, :allow_extra_keys => true) { result }
11
+ data_matches_schema(Brightbox::Compute::Formats::Full::VOLUME, allow_extra_keys: true) { result }
12
12
  end
13
13
 
14
14
  tests("#list_volumes") do
15
15
  result = Fog::Compute[:brightbox].list_volumes
16
- data_matches_schema(Brightbox::Compute::Formats::Collection::VOLUMES, :allow_extra_keys => true) { result }
16
+ data_matches_schema(Brightbox::Compute::Formats::Collection::VOLUMES, allow_extra_keys: true) { result }
17
17
 
18
18
  test("#{@volume_id} is listed") do
19
19
  result.any? do |volume|
@@ -24,7 +24,7 @@ Shindo.tests("Fog::Compute[:brightbox] | volume requests", ["brightbox"]) do
24
24
 
25
25
  tests("#get_volume('#{@volume_id}')") do
26
26
  result = Fog::Compute[:brightbox].get_volume(@volume_id)
27
- data_matches_schema(Brightbox::Compute::Formats::Full::VOLUME, :allow_extra_keys => true) { result }
27
+ data_matches_schema(Brightbox::Compute::Formats::Full::VOLUME, allow_extra_keys: true) { result }
28
28
  end
29
29
 
30
30
  update_options = {
@@ -32,7 +32,7 @@ Shindo.tests("Fog::Compute[:brightbox] | volume requests", ["brightbox"]) do
32
32
  }
33
33
  tests("#update_volume('#{@volume_id}', ...)") do
34
34
  result = Fog::Compute[:brightbox].update_volume(@volume_id, update_options)
35
- data_matches_schema(Brightbox::Compute::Formats::Full::VOLUME, :allow_extra_keys => true) { result }
35
+ data_matches_schema(Brightbox::Compute::Formats::Full::VOLUME, allow_extra_keys: true) { result }
36
36
 
37
37
  test("name has updated") { result["name"] == "New name" }
38
38
  end
@@ -41,7 +41,7 @@ Shindo.tests("Fog::Compute[:brightbox] | volume requests", ["brightbox"]) do
41
41
 
42
42
  tests("#delete_volume('#{@volume_id}')") do
43
43
  result = Fog::Compute[:brightbox].delete_volume(@volume_id)
44
- data_matches_schema(Brightbox::Compute::Formats::Full::VOLUME, :allow_extra_keys => true) { result }
44
+ data_matches_schema(Brightbox::Compute::Formats::Full::VOLUME, allow_extra_keys: true) { result }
45
45
  end
46
46
  end
47
47
 
@@ -4,13 +4,13 @@ Shindo.tests("Fog::Compute[:brightbox] | zone requests", ["brightbox"]) do
4
4
  pending if Fog.mocking?
5
5
  result = Fog::Compute[:brightbox].list_zones
6
6
  @zone_id = result.first["id"]
7
- data_matches_schema(Brightbox::Compute::Formats::Collection::ZONES, :allow_extra_keys => true) { result }
7
+ data_matches_schema(Brightbox::Compute::Formats::Collection::ZONES, allow_extra_keys: true) { result }
8
8
  end
9
9
 
10
10
  tests("#get_zone('#{@zone_id}')") do
11
11
  pending if Fog.mocking?
12
12
  result = Fog::Compute[:brightbox].get_zone(@zone_id)
13
- data_matches_schema(Brightbox::Compute::Formats::Full::ZONE, :allow_extra_keys => true) { result }
13
+ data_matches_schema(Brightbox::Compute::Formats::Full::ZONE, allow_extra_keys: true) { result }
14
14
  end
15
15
  end
16
16
 
data/tests/helper.rb CHANGED
@@ -3,6 +3,6 @@ ENV["FOG_CREDENTIAL"] = ENV["FOG_CREDENTIAL"] || "default"
3
3
 
4
4
  require "fog/brightbox"
5
5
 
6
- Excon.defaults.merge!(:debug_request => true, :debug_response => true)
6
+ Excon.defaults.merge!(debug_request: true, debug_response: true)
7
7
 
8
8
  require File.expand_path(File.join(File.dirname(__FILE__), "helpers", "mock_helper"))
@@ -20,9 +20,7 @@ def collection_tests(collection, params = {}, mocks_implemented = true)
20
20
  collection.all
21
21
  end
22
22
 
23
- if !Fog.mocking? || mocks_implemented
24
- @identity = @instance.identity
25
- end
23
+ @identity = @instance.identity if !Fog.mocking? || mocks_implemented
26
24
 
27
25
  tests("#get(#{@identity})").succeeds do
28
26
  pending if Fog.mocking? && !mocks_implemented
@@ -45,34 +43,29 @@ def collection_tests(collection, params = {}, mocks_implemented = true)
45
43
  end
46
44
 
47
45
  methods.each do |enum_method|
48
- if collection.respond_to?(enum_method)
49
- tests("##{enum_method}").succeeds do
50
- block_called = false
51
- collection.send(enum_method) { |_x| block_called = true }
52
- block_called
53
- end
46
+ next unless collection.respond_to?(enum_method)
47
+ tests("##{enum_method}").succeeds do
48
+ block_called = false
49
+ collection.send(enum_method) { |_x| block_called = true }
50
+ block_called
54
51
  end
55
52
  end
56
53
 
57
- %w(
58
- max_by min_by).each do |enum_method|
59
- if collection.respond_to?(enum_method)
60
- tests("##{enum_method}").succeeds do
61
- block_called = false
62
- collection.send(enum_method) { |_x| block_called = true; 0 }
63
- block_called
64
- end
54
+ %w[
55
+ max_by min_by
56
+ ].each do |enum_method|
57
+ next unless collection.respond_to?(enum_method)
58
+ tests("##{enum_method}").succeeds do
59
+ block_called = false
60
+ collection.send(enum_method) { |_x| block_called = true; 0 }
61
+ block_called
65
62
  end
66
63
  end
67
64
  end
68
65
 
69
- if block_given?
70
- yield(@instance)
71
- end
66
+ yield(@instance) if block_given?
72
67
 
73
- if !Fog.mocking? || mocks_implemented
74
- @instance.destroy
75
- end
68
+ @instance.destroy if !Fog.mocking? || mocks_implemented
76
69
  end
77
70
 
78
71
  tests("failure") do
@@ -1,23 +1,21 @@
1
1
  def server_tests(connection, params = {}, mocks_implemented = true)
2
2
  model_tests(connection.servers, params, mocks_implemented) do
3
- tests('#reload').returns(true) do
3
+ tests("#reload").returns(true) do
4
4
  pending if Fog.mocking? && !mocks_implemented
5
5
  @instance.wait_for { ready? }
6
6
  identity = @instance.identity
7
7
  !identity.nil? && identity == @instance.reload.identity
8
8
  end
9
9
 
10
- responds_to([:ready?, :state])
10
+ responds_to(%i[ready? state])
11
11
  yield if block_given?
12
12
 
13
- tests('#reboot').succeeds do
13
+ tests("#reboot").succeeds do
14
14
  pending if Fog.mocking? && !mocks_implemented
15
15
  @instance.wait_for { ready? }
16
16
  @instance.reboot
17
17
  end
18
18
 
19
- if !Fog.mocking? || mocks_implemented
20
- @instance.wait_for { ready? }
21
- end
19
+ @instance.wait_for { ready? } if !Fog.mocking? || mocks_implemented
22
20
  end
23
21
  end
@@ -83,11 +83,11 @@ module Shindo
83
83
  # @deprecated #formats is deprecated. Use #data_matches_schema instead
84
84
  def formats(format, strict = true)
85
85
  test("has proper format") do
86
- if strict
87
- options = { :allow_extra_keys => false, :allow_optional_rules => true }
88
- else
89
- options = { :allow_extra_keys => true, :allow_optional_rules => true }
90
- end
86
+ options = if strict
87
+ { allow_extra_keys: false, allow_optional_rules: true }
88
+ else
89
+ { allow_extra_keys: true, allow_optional_rules: true }
90
+ end
91
91
  validator = Fog::Schema::DataValidator.new
92
92
  valid = validator.validate(yield, format, options)
93
93
  @message = validator.message unless valid
@@ -1,20 +1,20 @@
1
1
  Shindo.tests("test_helper", "meta") do
2
2
  tests("comparing welcome data against schema") do
3
- data = { :welcome => "Hello" }
4
- data_matches_schema(:welcome => String) { data }
3
+ data = { welcome: "Hello" }
4
+ data_matches_schema(welcome: String) { data }
5
5
  end
6
6
 
7
- tests('#data_matches_schema') do
7
+ tests("#data_matches_schema") do
8
8
  tests("when value matches schema expectation") do
9
9
  data_matches_schema("key" => String) { { "key" => "Value" } }
10
10
  end
11
11
 
12
12
  tests("when values within an array all match schema expectation") do
13
- data_matches_schema({ "key" => [Integer] }) { { "key" => [1, 2] } }
13
+ data_matches_schema("key" => [Integer]) { { "key" => [1, 2] } }
14
14
  end
15
15
 
16
16
  tests("when nested values match schema expectation") do
17
- data_matches_schema("key" => { :nested_key => String }) { { "key" => { :nested_key => "Value" } } }
17
+ data_matches_schema("key" => { nested_key: String }) { { "key" => { nested_key: "Value" } } }
18
18
  end
19
19
 
20
20
  tests("when collection of values all match schema expectation") do
@@ -22,11 +22,11 @@ Shindo.tests("test_helper", "meta") do
22
22
  end
23
23
 
24
24
  tests("when collection is empty although schema covers optional members") do
25
- data_matches_schema([{ "key" => String }], :allow_optional_rules => true) { [] }
25
+ data_matches_schema([{ "key" => String }], allow_optional_rules: true) { [] }
26
26
  end
27
27
 
28
28
  tests("when additional keys are passed and not strict") do
29
- data_matches_schema({ "key" => String }, :allow_extra_keys => true) { { "key" => "Value", :extra => "Bonus" } }
29
+ data_matches_schema({ "key" => String }, allow_extra_keys: true) { { "key" => "Value", :extra => "Bonus" } }
30
30
  end
31
31
 
32
32
  tests("when value is nil and schema expects NilClass") do
@@ -45,16 +45,16 @@ Shindo.tests("test_helper", "meta") do
45
45
  data_matches_schema("time" => Time) { { "time" => Time.now } }
46
46
  end
47
47
 
48
- tests('when key is missing but value should be NilClass (#1477)') do
49
- data_matches_schema({ "key" => NilClass }, :allow_optional_rules => true) { {} }
48
+ tests("when key is missing but value should be NilClass (#1477)") do
49
+ data_matches_schema({ "key" => NilClass }, allow_optional_rules: true) { {} }
50
50
  end
51
51
 
52
- tests('when key is missing but value is nullable (#1477)') do
53
- data_matches_schema({ "key" => Fog::Nullable::String }, :allow_optional_rules => true) { {} }
52
+ tests("when key is missing but value is nullable (#1477)") do
53
+ data_matches_schema({ "key" => Fog::Nullable::String }, allow_optional_rules: true) { {} }
54
54
  end
55
55
  end
56
56
 
57
- tests('#formats backwards compatible changes') do
57
+ tests("#formats backwards compatible changes") do
58
58
  tests("when value matches schema expectation") do
59
59
  formats("key" => String) { { "key" => "Value" } }
60
60
  end
@@ -64,7 +64,7 @@ Shindo.tests("test_helper", "meta") do
64
64
  end
65
65
 
66
66
  tests("when nested values match schema expectation") do
67
- formats("key" => { :nested_key => String }) { { "key" => { :nested_key => "Value" } } }
67
+ formats("key" => { nested_key: String }) { { "key" => { nested_key: "Value" } } }
68
68
  end
69
69
 
70
70
  tests("when collection of values all match schema expectation") do
@@ -95,12 +95,12 @@ Shindo.tests("test_helper", "meta") do
95
95
  formats("time" => Time) { { "time" => Time.now } }
96
96
  end
97
97
 
98
- tests('when key is missing but value should be NilClass (#1477)') do
98
+ tests("when key is missing but value should be NilClass (#1477)") do
99
99
  formats("key" => NilClass) { {} }
100
100
  end
101
101
 
102
- tests('when key is missing but value is nullable (#1477)') do
103
- formats({ "key" => Fog::Nullable::String }) { {} }
102
+ tests("when key is missing but value is nullable (#1477)") do
103
+ formats("key" => Fog::Nullable::String) { {} }
104
104
  end
105
105
  end
106
106
  end
@@ -2,97 +2,95 @@
2
2
  #
3
3
  # FOG_MOCK=true fog
4
4
 
5
- if ENV["FOG_MOCK"] == "true"
6
- Fog.mock!
7
- end
5
+ Fog.mock! if ENV["FOG_MOCK"] == "true"
8
6
 
9
7
  # if in mocked mode, fill in some fake credentials for us
10
8
  if Fog.mock?
11
9
  Fog.credentials = {
12
- :aws_access_key_id => "aws_access_key_id",
13
- :aws_secret_access_key => "aws_secret_access_key",
14
- :ia_access_key_id => "aws_access_key_id",
15
- :ia_secret_access_key => "aws_secret_access_key",
16
- :bluebox_api_key => "bluebox_api_key",
17
- :bluebox_customer_id => "bluebox_customer_id",
18
- :brightbox_client_id => "brightbox_client_id",
19
- :brightbox_secret => "brightbox_secret",
20
- :cloudstack_disk_offering_id => "",
21
- :cloudstack_host => "http://cloudstack.example.org",
22
- :cloudstack_network_ids => "",
23
- :cloudstack_service_offering_id => "4437ac6c-9fe3-477a-57ec-60a5a45896a4",
24
- :cloudstack_template_id => "8a31cf9c-f248-0588-256e-9dbf58785216",
25
- :cloudstack_zone_id => "c554c592-e09c-9df5-7688-4a32754a4305",
26
- :cloudstack_project_id => "f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1f1",
27
- :clodo_api_key => "clodo_api_key",
28
- :clodo_username => "clodo_username",
29
- :digitalocean_api_key => "digitalocean_api_key",
30
- :digitalocean_client_id => "digitalocean_client_id",
31
- :dnsimple_email => "dnsimple_email",
32
- :dnsimple_password => "dnsimple_password",
33
- :dnsmadeeasy_api_key => "dnsmadeeasy_api_key",
34
- :dnsmadeeasy_secret_key => "dnsmadeeasy_secret_key",
35
- :glesys_username => "glesys_username",
36
- :glesys_api_key => "glesys_api_key",
37
- :go_grid_api_key => "go_grid_api_key",
38
- :go_grid_shared_secret => "go_grid_shared_secret",
39
- :hp_access_key => "hp_access_key",
40
- :hp_secret_key => "hp_secret_key",
41
- :hp_tenant_id => "hp_tenant_id",
42
- :hp_avl_zone => "hp_avl_zone",
43
- :hp_auth_uri => "http://hp/v2.0/tokens",
44
- :os_account_meta_temp_url_key => "os_account_meta_temp_url_key",
45
- :ibm_username => "ibm_username",
46
- :ibm_password => "ibm_password",
47
- :joyent_username => "joyentuser",
48
- :joyent_password => "joyentpass",
49
- :linode_api_key => "linode_api_key",
50
- :local_root => "~/.fog",
51
- :bare_metal_cloud_password => "bare_metal_cloud_password",
52
- :bare_metal_cloud_username => "bare_metal_cloud_username",
53
- :ninefold_compute_key => "ninefold_compute_key",
54
- :ninefold_compute_secret => "ninefold_compute_secret",
55
- :ninefold_storage_secret => "ninefold_storage_secret",
56
- :ninefold_storage_token => "ninefold_storage_token",
10
+ aws_access_key_id: "aws_access_key_id",
11
+ aws_secret_access_key: "aws_secret_access_key",
12
+ ia_access_key_id: "aws_access_key_id",
13
+ ia_secret_access_key: "aws_secret_access_key",
14
+ bluebox_api_key: "bluebox_api_key",
15
+ bluebox_customer_id: "bluebox_customer_id",
16
+ brightbox_client_id: "brightbox_client_id",
17
+ brightbox_secret: "brightbox_secret",
18
+ cloudstack_disk_offering_id: "",
19
+ cloudstack_host: "http://cloudstack.example.org",
20
+ cloudstack_network_ids: "",
21
+ cloudstack_service_offering_id: "4437ac6c-9fe3-477a-57ec-60a5a45896a4",
22
+ cloudstack_template_id: "8a31cf9c-f248-0588-256e-9dbf58785216",
23
+ cloudstack_zone_id: "c554c592-e09c-9df5-7688-4a32754a4305",
24
+ cloudstack_project_id: "f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1f1",
25
+ clodo_api_key: "clodo_api_key",
26
+ clodo_username: "clodo_username",
27
+ digitalocean_api_key: "digitalocean_api_key",
28
+ digitalocean_client_id: "digitalocean_client_id",
29
+ dnsimple_email: "dnsimple_email",
30
+ dnsimple_password: "dnsimple_password",
31
+ dnsmadeeasy_api_key: "dnsmadeeasy_api_key",
32
+ dnsmadeeasy_secret_key: "dnsmadeeasy_secret_key",
33
+ glesys_username: "glesys_username",
34
+ glesys_api_key: "glesys_api_key",
35
+ go_grid_api_key: "go_grid_api_key",
36
+ go_grid_shared_secret: "go_grid_shared_secret",
37
+ hp_access_key: "hp_access_key",
38
+ hp_secret_key: "hp_secret_key",
39
+ hp_tenant_id: "hp_tenant_id",
40
+ hp_avl_zone: "hp_avl_zone",
41
+ hp_auth_uri: "http://hp/v2.0/tokens",
42
+ os_account_meta_temp_url_key: "os_account_meta_temp_url_key",
43
+ ibm_username: "ibm_username",
44
+ ibm_password: "ibm_password",
45
+ joyent_username: "joyentuser",
46
+ joyent_password: "joyentpass",
47
+ linode_api_key: "linode_api_key",
48
+ local_root: "~/.fog",
49
+ bare_metal_cloud_password: "bare_metal_cloud_password",
50
+ bare_metal_cloud_username: "bare_metal_cloud_username",
51
+ ninefold_compute_key: "ninefold_compute_key",
52
+ ninefold_compute_secret: "ninefold_compute_secret",
53
+ ninefold_storage_secret: "ninefold_storage_secret",
54
+ ninefold_storage_token: "ninefold_storage_token",
57
55
  # :public_key_path => '~/.ssh/id_rsa.pub',
58
56
  # :private_key_path => '~/.ssh/id_rsa',
59
- :opennebula_endpoint => "http://opennebula:2633/RPC2",
60
- :opennebula_username => "oneadmin",
61
- :opennebula_password => "oneadmin",
62
- :openstack_api_key => "openstack_api_key",
63
- :openstack_username => "openstack_username",
64
- :openstack_tenant => "openstack_tenant",
65
- :openstack_auth_url => "http://openstack:35357/v2.0/tokens",
66
- :ovirt_url => "http://ovirt:8080/api",
67
- :ovirt_username => "admin@internal",
68
- :ovirt_password => "123123",
69
- :profitbricks_username => "profitbricks_username",
70
- :profitbricks_password => "profitbricks_password",
71
- :rackspace_api_key => "rackspace_api_key",
72
- :rackspace_region => "dfw",
73
- :rackspace_username => "rackspace_username",
74
- :sakuracloud_api_token => "sakuracloud_api_token",
75
- :sakuracloud_api_token_secret => "sakuracloud_api_token_secret",
76
- :vcloud_host => "vcloud_host",
77
- :vcloud_password => "vcloud_password",
78
- :vcloud_username => "vcloud_username",
79
- :vcloud_director_host => "vcloud-director-host",
80
- :vcloud_director_password => "vcloud_director_password",
81
- :vcloud_director_username => "vcd_user@vcd_org_name",
82
- :zerigo_email => "zerigo_email",
83
- :zerigo_token => "zerigo_token",
84
- :dynect_customer => "dynect_customer",
85
- :dynect_username => "dynect_username",
86
- :dynect_password => "dynect_password",
87
- :vsphere_server => "virtualcenter.lan",
88
- :vsphere_username => "apiuser",
89
- :vsphere_password => "apipassword",
90
- :vsphere_expected_pubkey_hash => "abcdef1234567890",
91
- :cloudsigma_username => "csuname",
92
- :cloudsigma_password => "cspass",
93
- :docker_username => "docker-fan",
94
- :docker_password => "i<3docker",
95
- :docker_email => "dockerfan@gmail.com",
96
- :docker_url => "unix://var/run/docker.sock"
57
+ opennebula_endpoint: "http://opennebula:2633/RPC2",
58
+ opennebula_username: "oneadmin",
59
+ opennebula_password: "oneadmin",
60
+ openstack_api_key: "openstack_api_key",
61
+ openstack_username: "openstack_username",
62
+ openstack_tenant: "openstack_tenant",
63
+ openstack_auth_url: "http://openstack:35357/v2.0/tokens",
64
+ ovirt_url: "http://ovirt:8080/api",
65
+ ovirt_username: "admin@internal",
66
+ ovirt_password: "123123",
67
+ profitbricks_username: "profitbricks_username",
68
+ profitbricks_password: "profitbricks_password",
69
+ rackspace_api_key: "rackspace_api_key",
70
+ rackspace_region: "dfw",
71
+ rackspace_username: "rackspace_username",
72
+ sakuracloud_api_token: "sakuracloud_api_token",
73
+ sakuracloud_api_token_secret: "sakuracloud_api_token_secret",
74
+ vcloud_host: "vcloud_host",
75
+ vcloud_password: "vcloud_password",
76
+ vcloud_username: "vcloud_username",
77
+ vcloud_director_host: "vcloud-director-host",
78
+ vcloud_director_password: "vcloud_director_password",
79
+ vcloud_director_username: "vcd_user@vcd_org_name",
80
+ zerigo_email: "zerigo_email",
81
+ zerigo_token: "zerigo_token",
82
+ dynect_customer: "dynect_customer",
83
+ dynect_username: "dynect_username",
84
+ dynect_password: "dynect_password",
85
+ vsphere_server: "virtualcenter.lan",
86
+ vsphere_username: "apiuser",
87
+ vsphere_password: "apipassword",
88
+ vsphere_expected_pubkey_hash: "abcdef1234567890",
89
+ cloudsigma_username: "csuname",
90
+ cloudsigma_password: "cspass",
91
+ docker_username: "docker-fan",
92
+ docker_password: "i<3docker",
93
+ docker_email: "dockerfan@gmail.com",
94
+ docker_url: "unix://var/run/docker.sock"
97
95
  }.merge(Fog.credentials)
98
96
  end
@@ -7,9 +7,7 @@ def model_tests(collection, params = {}, mocks_implemented = true)
7
7
  @instance.save
8
8
  end
9
9
 
10
- if block_given?
11
- yield(@instance)
12
- end
10
+ yield(@instance) if block_given?
13
11
 
14
12
  tests("#destroy").succeeds do
15
13
  pending if Fog.mocking? && !mocks_implemented