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
@@ -21,12 +21,12 @@ describe Fog::Brightbox::Compute::DatabaseServer do
21
21
 
22
22
  describe "when snapshotting with no options" do
23
23
  it "returns the database server" do
24
- stub_request(:post, "http://localhost/1.0/database_servers/dbs-12345/snapshot").
25
- with(:query => hash_including(:account_id),
26
- :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN" }).
27
- to_return(:status => 202, :body => %q({"id": "dbs-12345"}), :headers => {})
24
+ stub_request(:post, "http://localhost/1.0/database_servers/dbs-12345/snapshot")
25
+ .with(query: hash_including(:account_id),
26
+ headers: { "Authorization" => "Bearer FAKECACHEDTOKEN" })
27
+ .to_return(status: 202, body: '{"id": "dbs-12345"}', headers: {})
28
28
 
29
- @database_server = Fog::Brightbox::Compute::DatabaseServer.new(:service => service, :id => "dbs-12345")
29
+ @database_server = Fog::Brightbox::Compute::DatabaseServer.new(service: service, id: "dbs-12345")
30
30
  assert @database_server.snapshot
31
31
  end
32
32
  end
@@ -35,28 +35,28 @@ describe Fog::Brightbox::Compute::DatabaseServer do
35
35
  it "returns the new image" do
36
36
  link = "<https://api.gb1.brightbox.com/1.0/database_snapshots/dbi-12345>; rel=snapshot"
37
37
 
38
- stub_request(:post, "http://localhost/1.0/database_servers/dbs-12345/snapshot").
39
- with(:headers => { "Authorization" => "Bearer FAKECACHEDTOKEN" }).
40
- to_return(:status => 202, :body => "{}", :headers => { "Link" => link })
38
+ stub_request(:post, "http://localhost/1.0/database_servers/dbs-12345/snapshot")
39
+ .with(headers: { "Authorization" => "Bearer FAKECACHEDTOKEN" })
40
+ .to_return(status: 202, body: "{}", headers: { "Link" => link })
41
41
 
42
- stub_request(:get, "http://localhost/1.0/database_snapshots/dbi-12345").
43
- with(:query => hash_including(:account_id),
44
- :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN" }).
45
- to_return(:status => 200, :body => %q({"id": "dbs-12345"}))
46
- @database_server = Fog::Brightbox::Compute::DatabaseServer.new(:service => service, :id => "dbs-12345")
42
+ stub_request(:get, "http://localhost/1.0/database_snapshots/dbi-12345")
43
+ .with(query: hash_including(:account_id),
44
+ headers: { "Authorization" => "Bearer FAKECACHEDTOKEN" })
45
+ .to_return(status: 200, body: '{"id": "dbs-12345"}')
46
+ @database_server = Fog::Brightbox::Compute::DatabaseServer.new(service: service, id: "dbs-12345")
47
47
  assert_kind_of Fog::Brightbox::Compute::DatabaseSnapshot, @database_server.snapshot(true)
48
48
  end
49
49
  end
50
50
 
51
51
  describe "when building from a snapshot" do
52
52
  it "returns the new SQL instance" do
53
- stub_request(:post, "http://localhost/1.0/database_servers").
54
- with(:query => hash_including(:account_id),
55
- :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN" },
56
- :body => hash_including(:snapshot => "dbi-lv426")).
57
- to_return(:status => 202, :body => %q({"id": "dbs-12345"}))
53
+ stub_request(:post, "http://localhost/1.0/database_servers")
54
+ .with(query: hash_including(:account_id),
55
+ headers: { "Authorization" => "Bearer FAKECACHEDTOKEN" },
56
+ body: hash_including(snapshot: "dbi-lv426"))
57
+ .to_return(status: 202, body: '{"id": "dbs-12345"}')
58
58
 
59
- @database_server = Fog::Brightbox::Compute::DatabaseServer.new(:service => service, :snapshot_id => "dbi-lv426")
59
+ @database_server = Fog::Brightbox::Compute::DatabaseServer.new(service: service, snapshot_id: "dbi-lv426")
60
60
  @database_server.save
61
61
  assert_kind_of Fog::Brightbox::Compute::DatabaseServer, @database_server
62
62
  assert_equal "dbs-12345", @database_server.id
@@ -6,24 +6,24 @@ describe Fog::Brightbox::Compute::ImageSelector do
6
6
  describe "#latest_ubuntu" do
7
7
  it do
8
8
  image_list = [
9
- {"id"=>"img-kppxh", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-kppxh", "name"=>"ubuntu-xenial-16.04-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:16.04:amd64/20211001/disk1.img, Release: release", "source"=>"tmp54tt71pg", "arch"=>"x86_64", "created_at"=>"2021-10-02T06:57:09.000Z", "owner"=>"acc-kg71m", "official"=>true, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>394, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
10
- {"id"=>"img-bugr2", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-bugr2", "name"=>"ubuntu-xenial-16.04-i386-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:16.04:i386/20211001/disk1.img, Release: release", "source"=>"tmplj717rjf", "arch"=>"i686", "created_at"=>"2021-10-02T06:58:18.000Z", "owner"=>"acc-kg71m", "official"=>true, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>385, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
11
- {"id"=>"img-6vfpp", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-6vfpp", "name"=>"ubuntu-xenial-daily-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:16.04:amd64/20211001/disk1.img, Release: daily", "source"=>"tmp3aj5trto", "arch"=>"x86_64", "created_at"=>"2021-10-02T06:58:57.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>394, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
12
- {"id"=>"img-x08p6", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-x08p6", "name"=>"ubuntu-bionic-18.04-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:18.04:amd64/20220523/disk1.img, Release: release", "source"=>"tmpcyevpow5", "arch"=>"x86_64", "created_at"=>"2022-05-24T06:57:15.000Z", "owner"=>"acc-kg71m", "official"=>true, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>480, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
13
- {"id"=>"img-jrbnn", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-jrbnn", "name"=>"ubuntu-bionic-18.04-i386-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:18.04:i386/20220523/disk1.img, Release: release", "source"=>"tmpw502837r", "arch"=>"i686", "created_at"=>"2022-05-24T06:57:44.000Z", "owner"=>"acc-kg71m", "official"=>true, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>450, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
14
- {"id"=>"img-1cbbg", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-1cbbg", "name"=>"ubuntu-focal-daily-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:20.04:amd64/20220530/disk1.img, Release: daily", "source"=>"tmpa2iezlb7", "arch"=>"x86_64", "created_at"=>"2022-06-01T07:06:08.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>685, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
15
- {"id"=>"img-cjc8m", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-cjc8m", "name"=>"ubuntu-focal-20.04-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:20.04:amd64/20220530/disk1.img, Release: release", "source"=>"tmppadp2ka9", "arch"=>"x86_64", "created_at"=>"2022-06-02T06:57:21.000Z", "owner"=>"acc-kg71m", "official"=>true, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>685, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
16
- {"id"=>"img-yes2q", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-yes2q", "name"=>"ubuntu-bionic-daily-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:18.04:amd64/20220530/disk1.img, Release: daily", "source"=>"tmp7b0ty_cz", "arch"=>"x86_64", "created_at"=>"2022-06-02T06:59:06.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>480, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
17
- {"id"=>"img-44xv2", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-44xv2", "name"=>"ubuntu-bionic-daily-i386-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:18.04:i386/20220530/disk1.img, Release: daily", "source"=>"tmpcsk_ejc9", "arch"=>"i686", "created_at"=>"2022-06-02T06:59:33.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>450, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
18
- {"id"=>"img-axy3r", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-axy3r", "name"=>"ubuntu-impish-daily-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:21.10:amd64/20220604/disk1.img, Release: daily", "source"=>"tmpq4xcgkhd", "arch"=>"x86_64", "created_at"=>"2022-06-05T06:57:52.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>699, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
19
- {"id"=>"img-5sf6z", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-5sf6z", "name"=>"ubuntu-jammy-daily-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:22.04:amd64/20220604/disk1.img, Release: daily", "source"=>"tmp6lwsv5cb", "arch"=>"x86_64", "created_at"=>"2022-06-05T06:58:33.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>709, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
20
- {"id"=>"img-vuptu", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-vuptu", "name"=>"ubuntu-kinetic-daily-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:22.10:amd64/20220605/disk1.img, Release: daily", "source"=>"tmpj_k3e6u1", "arch"=>"x86_64", "created_at"=>"2022-06-06T06:57:58.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>752, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
21
- {"id"=>"img-tqaxd", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-tqaxd", "name"=>"ubuntu-impish-21.10-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:21.10:amd64/20220604/disk1.img, Release: release", "source"=>"tmp_xphnxch", "arch"=>"x86_64", "created_at"=>"2022-06-07T06:57:33.000Z", "owner"=>"acc-kg71m", "official"=>true, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>699, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
22
- {"id"=>"img-7d1e3", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-7d1e3", "name"=>"ubuntu-jammy-22.04-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:22.04:amd64/20220604/disk1.img, Release: release", "source"=>"tmp11_42l44", "arch"=>"x86_64", "created_at"=>"2022-06-07T06:58:16.000Z", "owner"=>"acc-kg71m", "official"=>true, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>709, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
23
- {"id"=>"img-kg2oa", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-kg2oa", "name"=>"ubuntu-bionic-18.04-amd64-minimal", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:minimal:18.04:amd64/20220607/disk1.img, Release: minimal release", "source"=>"tmpd7d5lvyb", "arch"=>"x86_64", "created_at"=>"2022-06-08T07:01:21.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>258, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
24
- {"id"=>"img-sdofr", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-sdofr", "name"=>"ubuntu-focal-20.04-amd64-minimal", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:minimal:20.04:amd64/20220607/disk1.img, Release: minimal release", "source"=>"tmpl6wvuqu9", "arch"=>"x86_64", "created_at"=>"2022-06-08T07:01:49.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>330, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
25
- {"id"=>"img-7wwg7", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-7wwg7", "name"=>"ubuntu-impish-21.10-amd64-minimal", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:minimal:21.10:amd64/20220607/disk1.img, Release: minimal release", "source"=>"tmpfkqj3pjo", "arch"=>"x86_64", "created_at"=>"2022-06-08T07:02:13.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>328, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
26
- {"id"=>"img-ielp9", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-ielp9", "name"=>"ubuntu-jammy-22.04-amd64-minimal", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:minimal:22.04:amd64/20220607/disk1.img, Release: minimal release", "source"=>"tmpd0ctsx1v", "arch"=>"x86_64", "created_at"=>"2022-06-08T07:02:38.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>353, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil}
9
+ { "id" => "img-kppxh", "resource_type" => "image", "url" => "https://api.gb1s.brightbox.com/1.0/images/img-kppxh", "name" => "ubuntu-xenial-16.04-amd64-server", "username" => "ubuntu", "status" => "available", "locked" => false, "description" => "ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:16.04:amd64/20211001/disk1.img, Release: release", "source" => "tmp54tt71pg", "arch" => "x86_64", "created_at" => "2021-10-02T06:57:09.000Z", "owner" => "acc-kg71m", "official" => true, "public" => true, "compatibility_mode" => false, "source_type" => "upload", "source_trigger" => "manual", "disk_size" => 394, "virtual_size" => 2252, "min_ram" => nil, "ancestor" => nil },
10
+ { "id" => "img-bugr2", "resource_type" => "image", "url" => "https://api.gb1s.brightbox.com/1.0/images/img-bugr2", "name" => "ubuntu-xenial-16.04-i386-server", "username" => "ubuntu", "status" => "available", "locked" => false, "description" => "ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:16.04:i386/20211001/disk1.img, Release: release", "source" => "tmplj717rjf", "arch" => "i686", "created_at" => "2021-10-02T06:58:18.000Z", "owner" => "acc-kg71m", "official" => true, "public" => true, "compatibility_mode" => false, "source_type" => "upload", "source_trigger" => "manual", "disk_size" => 385, "virtual_size" => 2252, "min_ram" => nil, "ancestor" => nil },
11
+ { "id" => "img-6vfpp", "resource_type" => "image", "url" => "https://api.gb1s.brightbox.com/1.0/images/img-6vfpp", "name" => "ubuntu-xenial-daily-amd64-server", "username" => "ubuntu", "status" => "available", "locked" => false, "description" => "ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:16.04:amd64/20211001/disk1.img, Release: daily", "source" => "tmp3aj5trto", "arch" => "x86_64", "created_at" => "2021-10-02T06:58:57.000Z", "owner" => "acc-yw7i0", "official" => false, "public" => true, "compatibility_mode" => false, "source_type" => "upload", "source_trigger" => "manual", "disk_size" => 394, "virtual_size" => 2252, "min_ram" => nil, "ancestor" => nil },
12
+ { "id" => "img-x08p6", "resource_type" => "image", "url" => "https://api.gb1s.brightbox.com/1.0/images/img-x08p6", "name" => "ubuntu-bionic-18.04-amd64-server", "username" => "ubuntu", "status" => "available", "locked" => false, "description" => "ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:18.04:amd64/20220523/disk1.img, Release: release", "source" => "tmpcyevpow5", "arch" => "x86_64", "created_at" => "2022-05-24T06:57:15.000Z", "owner" => "acc-kg71m", "official" => true, "public" => true, "compatibility_mode" => false, "source_type" => "upload", "source_trigger" => "manual", "disk_size" => 480, "virtual_size" => 2252, "min_ram" => nil, "ancestor" => nil },
13
+ { "id" => "img-jrbnn", "resource_type" => "image", "url" => "https://api.gb1s.brightbox.com/1.0/images/img-jrbnn", "name" => "ubuntu-bionic-18.04-i386-server", "username" => "ubuntu", "status" => "available", "locked" => false, "description" => "ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:18.04:i386/20220523/disk1.img, Release: release", "source" => "tmpw502837r", "arch" => "i686", "created_at" => "2022-05-24T06:57:44.000Z", "owner" => "acc-kg71m", "official" => true, "public" => true, "compatibility_mode" => false, "source_type" => "upload", "source_trigger" => "manual", "disk_size" => 450, "virtual_size" => 2252, "min_ram" => nil, "ancestor" => nil },
14
+ { "id" => "img-1cbbg", "resource_type" => "image", "url" => "https://api.gb1s.brightbox.com/1.0/images/img-1cbbg", "name" => "ubuntu-focal-daily-amd64-server", "username" => "ubuntu", "status" => "available", "locked" => false, "description" => "ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:20.04:amd64/20220530/disk1.img, Release: daily", "source" => "tmpa2iezlb7", "arch" => "x86_64", "created_at" => "2022-06-01T07:06:08.000Z", "owner" => "acc-yw7i0", "official" => false, "public" => true, "compatibility_mode" => false, "source_type" => "upload", "source_trigger" => "manual", "disk_size" => 685, "virtual_size" => 2252, "min_ram" => nil, "ancestor" => nil },
15
+ { "id" => "img-cjc8m", "resource_type" => "image", "url" => "https://api.gb1s.brightbox.com/1.0/images/img-cjc8m", "name" => "ubuntu-focal-20.04-amd64-server", "username" => "ubuntu", "status" => "available", "locked" => false, "description" => "ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:20.04:amd64/20220530/disk1.img, Release: release", "source" => "tmppadp2ka9", "arch" => "x86_64", "created_at" => "2022-06-02T06:57:21.000Z", "owner" => "acc-kg71m", "official" => true, "public" => true, "compatibility_mode" => false, "source_type" => "upload", "source_trigger" => "manual", "disk_size" => 685, "virtual_size" => 2252, "min_ram" => nil, "ancestor" => nil },
16
+ { "id" => "img-yes2q", "resource_type" => "image", "url" => "https://api.gb1s.brightbox.com/1.0/images/img-yes2q", "name" => "ubuntu-bionic-daily-amd64-server", "username" => "ubuntu", "status" => "available", "locked" => false, "description" => "ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:18.04:amd64/20220530/disk1.img, Release: daily", "source" => "tmp7b0ty_cz", "arch" => "x86_64", "created_at" => "2022-06-02T06:59:06.000Z", "owner" => "acc-yw7i0", "official" => false, "public" => true, "compatibility_mode" => false, "source_type" => "upload", "source_trigger" => "manual", "disk_size" => 480, "virtual_size" => 2252, "min_ram" => nil, "ancestor" => nil },
17
+ { "id" => "img-44xv2", "resource_type" => "image", "url" => "https://api.gb1s.brightbox.com/1.0/images/img-44xv2", "name" => "ubuntu-bionic-daily-i386-server", "username" => "ubuntu", "status" => "available", "locked" => false, "description" => "ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:18.04:i386/20220530/disk1.img, Release: daily", "source" => "tmpcsk_ejc9", "arch" => "i686", "created_at" => "2022-06-02T06:59:33.000Z", "owner" => "acc-yw7i0", "official" => false, "public" => true, "compatibility_mode" => false, "source_type" => "upload", "source_trigger" => "manual", "disk_size" => 450, "virtual_size" => 2252, "min_ram" => nil, "ancestor" => nil },
18
+ { "id" => "img-axy3r", "resource_type" => "image", "url" => "https://api.gb1s.brightbox.com/1.0/images/img-axy3r", "name" => "ubuntu-impish-daily-amd64-server", "username" => "ubuntu", "status" => "available", "locked" => false, "description" => "ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:21.10:amd64/20220604/disk1.img, Release: daily", "source" => "tmpq4xcgkhd", "arch" => "x86_64", "created_at" => "2022-06-05T06:57:52.000Z", "owner" => "acc-yw7i0", "official" => false, "public" => true, "compatibility_mode" => false, "source_type" => "upload", "source_trigger" => "manual", "disk_size" => 699, "virtual_size" => 2252, "min_ram" => nil, "ancestor" => nil },
19
+ { "id" => "img-5sf6z", "resource_type" => "image", "url" => "https://api.gb1s.brightbox.com/1.0/images/img-5sf6z", "name" => "ubuntu-jammy-daily-amd64-server", "username" => "ubuntu", "status" => "available", "locked" => false, "description" => "ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:22.04:amd64/20220604/disk1.img, Release: daily", "source" => "tmp6lwsv5cb", "arch" => "x86_64", "created_at" => "2022-06-05T06:58:33.000Z", "owner" => "acc-yw7i0", "official" => false, "public" => true, "compatibility_mode" => false, "source_type" => "upload", "source_trigger" => "manual", "disk_size" => 709, "virtual_size" => 2252, "min_ram" => nil, "ancestor" => nil },
20
+ { "id" => "img-vuptu", "resource_type" => "image", "url" => "https://api.gb1s.brightbox.com/1.0/images/img-vuptu", "name" => "ubuntu-kinetic-daily-amd64-server", "username" => "ubuntu", "status" => "available", "locked" => false, "description" => "ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:22.10:amd64/20220605/disk1.img, Release: daily", "source" => "tmpj_k3e6u1", "arch" => "x86_64", "created_at" => "2022-06-06T06:57:58.000Z", "owner" => "acc-yw7i0", "official" => false, "public" => true, "compatibility_mode" => false, "source_type" => "upload", "source_trigger" => "manual", "disk_size" => 752, "virtual_size" => 2252, "min_ram" => nil, "ancestor" => nil },
21
+ { "id" => "img-tqaxd", "resource_type" => "image", "url" => "https://api.gb1s.brightbox.com/1.0/images/img-tqaxd", "name" => "ubuntu-impish-21.10-amd64-server", "username" => "ubuntu", "status" => "available", "locked" => false, "description" => "ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:21.10:amd64/20220604/disk1.img, Release: release", "source" => "tmp_xphnxch", "arch" => "x86_64", "created_at" => "2022-06-07T06:57:33.000Z", "owner" => "acc-kg71m", "official" => true, "public" => true, "compatibility_mode" => false, "source_type" => "upload", "source_trigger" => "manual", "disk_size" => 699, "virtual_size" => 2252, "min_ram" => nil, "ancestor" => nil },
22
+ { "id" => "img-7d1e3", "resource_type" => "image", "url" => "https://api.gb1s.brightbox.com/1.0/images/img-7d1e3", "name" => "ubuntu-jammy-22.04-amd64-server", "username" => "ubuntu", "status" => "available", "locked" => false, "description" => "ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:22.04:amd64/20220604/disk1.img, Release: release", "source" => "tmp11_42l44", "arch" => "x86_64", "created_at" => "2022-06-07T06:58:16.000Z", "owner" => "acc-kg71m", "official" => true, "public" => true, "compatibility_mode" => false, "source_type" => "upload", "source_trigger" => "manual", "disk_size" => 709, "virtual_size" => 2252, "min_ram" => nil, "ancestor" => nil },
23
+ { "id" => "img-kg2oa", "resource_type" => "image", "url" => "https://api.gb1s.brightbox.com/1.0/images/img-kg2oa", "name" => "ubuntu-bionic-18.04-amd64-minimal", "username" => "ubuntu", "status" => "available", "locked" => false, "description" => "ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:minimal:18.04:amd64/20220607/disk1.img, Release: minimal release", "source" => "tmpd7d5lvyb", "arch" => "x86_64", "created_at" => "2022-06-08T07:01:21.000Z", "owner" => "acc-yw7i0", "official" => false, "public" => true, "compatibility_mode" => false, "source_type" => "upload", "source_trigger" => "manual", "disk_size" => 258, "virtual_size" => 2252, "min_ram" => nil, "ancestor" => nil },
24
+ { "id" => "img-sdofr", "resource_type" => "image", "url" => "https://api.gb1s.brightbox.com/1.0/images/img-sdofr", "name" => "ubuntu-focal-20.04-amd64-minimal", "username" => "ubuntu", "status" => "available", "locked" => false, "description" => "ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:minimal:20.04:amd64/20220607/disk1.img, Release: minimal release", "source" => "tmpl6wvuqu9", "arch" => "x86_64", "created_at" => "2022-06-08T07:01:49.000Z", "owner" => "acc-yw7i0", "official" => false, "public" => true, "compatibility_mode" => false, "source_type" => "upload", "source_trigger" => "manual", "disk_size" => 330, "virtual_size" => 2252, "min_ram" => nil, "ancestor" => nil },
25
+ { "id" => "img-7wwg7", "resource_type" => "image", "url" => "https://api.gb1s.brightbox.com/1.0/images/img-7wwg7", "name" => "ubuntu-impish-21.10-amd64-minimal", "username" => "ubuntu", "status" => "available", "locked" => false, "description" => "ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:minimal:21.10:amd64/20220607/disk1.img, Release: minimal release", "source" => "tmpfkqj3pjo", "arch" => "x86_64", "created_at" => "2022-06-08T07:02:13.000Z", "owner" => "acc-yw7i0", "official" => false, "public" => true, "compatibility_mode" => false, "source_type" => "upload", "source_trigger" => "manual", "disk_size" => 328, "virtual_size" => 2252, "min_ram" => nil, "ancestor" => nil },
26
+ { "id" => "img-ielp9", "resource_type" => "image", "url" => "https://api.gb1s.brightbox.com/1.0/images/img-ielp9", "name" => "ubuntu-jammy-22.04-amd64-minimal", "username" => "ubuntu", "status" => "available", "locked" => false, "description" => "ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:minimal:22.04:amd64/20220607/disk1.img, Release: minimal release", "source" => "tmpd0ctsx1v", "arch" => "x86_64", "created_at" => "2022-06-08T07:02:38.000Z", "owner" => "acc-yw7i0", "official" => false, "public" => true, "compatibility_mode" => false, "source_type" => "upload", "source_trigger" => "manual", "disk_size" => 353, "virtual_size" => 2252, "min_ram" => nil, "ancestor" => nil }
27
27
  ]
28
28
 
29
29
  selector = subject.new(image_list)
@@ -33,12 +33,12 @@ describe Fog::Brightbox::Compute::LoadBalancer do
33
33
  nodes: []
34
34
  }
35
35
 
36
- stub_request(:post, "http://localhost/1.0/load_balancers").
37
- with(:query => hash_including(:account_id),
38
- :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN" }).
39
- to_return(:status => 202, :body => %q({"id": "lba-12345"}), :headers => {})
36
+ stub_request(:post, "http://localhost/1.0/load_balancers")
37
+ .with(query: hash_including(:account_id),
38
+ headers: { "Authorization" => "Bearer FAKECACHEDTOKEN" })
39
+ .to_return(status: 202, body: '{"id": "lba-12345"}', headers: {})
40
40
 
41
- @load_balancer = Fog::Brightbox::Compute::LoadBalancer.new({ :service => service }.merge(options))
41
+ @load_balancer = Fog::Brightbox::Compute::LoadBalancer.new({ service: service }.merge(options))
42
42
  assert @load_balancer.save
43
43
  end
44
44
  end
@@ -26,14 +26,14 @@ describe Fog::Brightbox::Compute::Server do
26
26
  image_id: "img-12345"
27
27
  }
28
28
 
29
- stub_request(:post, "http://localhost/1.0/servers").
30
- with(:query => hash_including(:account_id),
31
- :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN",
32
- "Content-Type" => "application/json" },
33
- :body => hash_including(:image => "img-12345")).
34
- to_return(:status => 202, :body => %q({"id":"srv-12345"}), :headers => {})
35
-
36
- @server = Fog::Brightbox::Compute::Server.new({ :service => service }.merge(options))
29
+ stub_request(:post, "http://localhost/1.0/servers")
30
+ .with(query: hash_including(:account_id),
31
+ headers: { "Authorization" => "Bearer FAKECACHEDTOKEN",
32
+ "Content-Type" => "application/json" },
33
+ body: hash_including(image: "img-12345"))
34
+ .to_return(status: 202, body: '{"id":"srv-12345"}', headers: {})
35
+
36
+ @server = Fog::Brightbox::Compute::Server.new({ service: service }.merge(options))
37
37
  assert @server.save
38
38
  end
39
39
  end
@@ -53,14 +53,14 @@ describe Fog::Brightbox::Compute::Server do
53
53
  ]
54
54
  }
55
55
 
56
- stub_request(:post, "http://localhost/1.0/servers").
57
- with(:query => hash_including(:account_id),
58
- :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN",
59
- "Content-Type" => "application/json" },
60
- :body => hash_including(expected_args)).
61
- to_return(:status => 202, :body => %q({"id":"srv-12345"}), :headers => {})
56
+ stub_request(:post, "http://localhost/1.0/servers")
57
+ .with(query: hash_including(:account_id),
58
+ headers: { "Authorization" => "Bearer FAKECACHEDTOKEN",
59
+ "Content-Type" => "application/json" },
60
+ body: hash_including(expected_args))
61
+ .to_return(status: 202, body: '{"id":"srv-12345"}', headers: {})
62
62
 
63
- @server = Fog::Brightbox::Compute::Server.new({ :service => service }.merge(options))
63
+ @server = Fog::Brightbox::Compute::Server.new({ service: service }.merge(options))
64
64
  assert @server.save
65
65
  end
66
66
  end
@@ -72,16 +72,16 @@ describe Fog::Brightbox::Compute::Server do
72
72
  disk_encrypted: true
73
73
  }
74
74
 
75
- stub_request(:post, "http://localhost/1.0/servers").
76
- with(:query => hash_including(:account_id),
77
- :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN",
78
- "Content-Type" => "application/json" },
79
- :body => hash_including(:disk_encrypted => true)).
80
- to_return(:status => 202,
81
- :body => %q({"id":"srv-12345","disk_encrypted":true}),
82
- :headers => {})
75
+ stub_request(:post, "http://localhost/1.0/servers")
76
+ .with(query: hash_including(:account_id),
77
+ headers: { "Authorization" => "Bearer FAKECACHEDTOKEN",
78
+ "Content-Type" => "application/json" },
79
+ body: hash_including(disk_encrypted: true))
80
+ .to_return(status: 202,
81
+ body: '{"id":"srv-12345","disk_encrypted":true}',
82
+ headers: {})
83
83
 
84
- @server = Fog::Brightbox::Compute::Server.new({ :service => service }.merge(options))
84
+ @server = Fog::Brightbox::Compute::Server.new({ service: service }.merge(options))
85
85
  assert @server.save
86
86
  assert @server.disk_encrypted
87
87
  end
@@ -97,26 +97,26 @@ describe Fog::Brightbox::Compute::Server do
97
97
  volumes: [{ volume: "vol-12345" }]
98
98
  }
99
99
 
100
- stub_request(:post, "http://localhost/1.0/servers").
101
- with(:query => hash_including(:account_id),
102
- :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN",
103
- "Content-Type" => "application/json" },
104
- :body => hash_including(expected_args)).
105
- to_return(:status => 202, :body => %q({"id":"srv-12345"}), :headers => {})
100
+ stub_request(:post, "http://localhost/1.0/servers")
101
+ .with(query: hash_including(:account_id),
102
+ headers: { "Authorization" => "Bearer FAKECACHEDTOKEN",
103
+ "Content-Type" => "application/json" },
104
+ body: hash_including(expected_args))
105
+ .to_return(status: 202, body: '{"id":"srv-12345"}', headers: {})
106
106
 
107
- @server = Fog::Brightbox::Compute::Server.new({ :service => service }.merge(options))
107
+ @server = Fog::Brightbox::Compute::Server.new({ service: service }.merge(options))
108
108
  assert @server.save
109
109
  end
110
110
  end
111
111
 
112
112
  describe "when snapshotting with no options" do
113
113
  it "returns the server" do
114
- stub_request(:post, "http://localhost/1.0/servers/srv-12345/snapshot").
115
- with(:query => hash_including(:account_id),
116
- :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN" }).
117
- to_return(:status => 202, :body => %q({"id": "srv-12345"}), :headers => {})
114
+ stub_request(:post, "http://localhost/1.0/servers/srv-12345/snapshot")
115
+ .with(query: hash_including(:account_id),
116
+ headers: { "Authorization" => "Bearer FAKECACHEDTOKEN" })
117
+ .to_return(status: 202, body: '{"id": "srv-12345"}', headers: {})
118
118
 
119
- @server = Fog::Brightbox::Compute::Server.new(:service => service, :id => "srv-12345")
119
+ @server = Fog::Brightbox::Compute::Server.new(service: service, id: "srv-12345")
120
120
  assert_kind_of Hash, @server.snapshot
121
121
  end
122
122
  end
@@ -125,15 +125,15 @@ describe Fog::Brightbox::Compute::Server do
125
125
  it "returns the new image" do
126
126
  link = "<https://api.gb1.brightbox.com/1.0/images/img-12345>; rel=snapshot"
127
127
 
128
- stub_request(:post, "http://localhost/1.0/servers/srv-12345/snapshot").
129
- with(:headers => { "Authorization" => "Bearer FAKECACHEDTOKEN" }).
130
- to_return(:status => 202, :body => "{}", :headers => { "Link" => link })
128
+ stub_request(:post, "http://localhost/1.0/servers/srv-12345/snapshot")
129
+ .with(headers: { "Authorization" => "Bearer FAKECACHEDTOKEN" })
130
+ .to_return(status: 202, body: "{}", headers: { "Link" => link })
131
131
 
132
- stub_request(:get, "http://localhost/1.0/images/img-12345").
133
- with(:query => hash_including(:account_id),
134
- :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN" }).
135
- to_return(:status => 200, :body => %q({"id": "img-12345"}))
136
- @server = Fog::Brightbox::Compute::Server.new(:service => service, :id => "srv-12345")
132
+ stub_request(:get, "http://localhost/1.0/images/img-12345")
133
+ .with(query: hash_including(:account_id),
134
+ headers: { "Authorization" => "Bearer FAKECACHEDTOKEN" })
135
+ .to_return(status: 200, body: '{"id": "img-12345"}')
136
+ @server = Fog::Brightbox::Compute::Server.new(service: service, id: "srv-12345")
137
137
  assert_kind_of Fog::Brightbox::Compute::Image, @server.snapshot(true)
138
138
  end
139
139
  end
@@ -111,14 +111,14 @@ describe Fog::Brightbox::Compute::Volume do
111
111
  server = service.servers.new
112
112
  server.id = "srv-12345"
113
113
 
114
- stub_request(:post, "http://localhost/1.0/volumes/vol-12345/attach").
115
- with(:query => hash_including(:account_id),
116
- :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN",
117
- "Content-Type" => "application/json" },
118
- :body => hash_including(:server => "srv-12345")).
119
- to_return(:status => 202,
120
- :body => %q({"id":"vol-12345","status":"attached"}),
121
- :headers => {})
114
+ stub_request(:post, "http://localhost/1.0/volumes/vol-12345/attach")
115
+ .with(query: hash_including(:account_id),
116
+ headers: { "Authorization" => "Bearer FAKECACHEDTOKEN",
117
+ "Content-Type" => "application/json" },
118
+ body: hash_including(server: "srv-12345"))
119
+ .to_return(status: 202,
120
+ body: '{"id":"vol-12345","status":"attached"}',
121
+ headers: {})
122
122
 
123
123
  subject.attach(server)
124
124
 
@@ -141,14 +141,14 @@ describe Fog::Brightbox::Compute::Volume do
141
141
  refute subject.delete_with_server
142
142
  assert subject.persisted?
143
143
 
144
- stub_request(:post, "http://localhost/1.0/volumes/vol-12345/copy").
145
- with(:query => hash_including(:account_id),
146
- :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN",
147
- "Content-Type" => "application/json" },
148
- :body => hash_including(:delete_with_server => true)).
149
- to_return(:status => 202,
150
- :body => %q({"id":"vol-abcde","delete_with_server":true,"name":"Copy of vol-12345 (Impish Image)","status":"detached"}),
151
- :headers => {})
144
+ stub_request(:post, "http://localhost/1.0/volumes/vol-12345/copy")
145
+ .with(query: hash_including(:account_id),
146
+ headers: { "Authorization" => "Bearer FAKECACHEDTOKEN",
147
+ "Content-Type" => "application/json" },
148
+ body: hash_including(delete_with_server: true))
149
+ .to_return(status: 202,
150
+ body: '{"id":"vol-abcde","delete_with_server":true,"name":"Copy of vol-12345 (Impish Image)","status":"detached"}',
151
+ headers: {})
152
152
 
153
153
  copy = subject.copy(delete_with_server: true)
154
154
 
@@ -166,13 +166,13 @@ describe Fog::Brightbox::Compute::Volume do
166
166
 
167
167
  assert subject.persisted?
168
168
 
169
- stub_request(:post, "http://localhost/1.0/volumes/vol-12345/detach").
170
- with(:query => hash_including(:account_id),
171
- :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN",
172
- "Content-Type" => "application/json" }).
173
- to_return(:status => 202,
174
- :body => %q({"id":"vol-12345","status":"detached"}),
175
- :headers => {})
169
+ stub_request(:post, "http://localhost/1.0/volumes/vol-12345/detach")
170
+ .with(query: hash_including(:account_id),
171
+ headers: { "Authorization" => "Bearer FAKECACHEDTOKEN",
172
+ "Content-Type" => "application/json" })
173
+ .to_return(status: 202,
174
+ body: '{"id":"vol-12345","status":"detached"}',
175
+ headers: {})
176
176
 
177
177
  subject.detach
178
178
 
@@ -185,13 +185,13 @@ describe Fog::Brightbox::Compute::Volume do
185
185
  subject.id = "vol-12345"
186
186
  assert subject.persisted?
187
187
 
188
- stub_request(:delete, "http://localhost/1.0/volumes/vol-12345").
189
- with(:query => hash_including(:account_id),
190
- :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN",
191
- "Content-Type" => "application/json" }).
192
- to_return(:status => 202,
193
- :body => %q({"id":"vol-12345","status":"deleting"}),
194
- :headers => {})
188
+ stub_request(:delete, "http://localhost/1.0/volumes/vol-12345")
189
+ .with(query: hash_including(:account_id),
190
+ headers: { "Authorization" => "Bearer FAKECACHEDTOKEN",
191
+ "Content-Type" => "application/json" })
192
+ .to_return(status: 202,
193
+ body: '{"id":"vol-12345","status":"deleting"}',
194
+ headers: {})
195
195
 
196
196
  subject.destroy
197
197
  assert_equal "deleting", subject.state
@@ -231,14 +231,14 @@ describe Fog::Brightbox::Compute::Volume do
231
231
 
232
232
  assert subject.persisted?
233
233
 
234
- stub_request(:post, "http://localhost/1.0/volumes/vol-12345/resize").
235
- with(:query => hash_including(:account_id),
236
- :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN",
237
- "Content-Type" => "application/json" },
238
- :body => hash_including(:from => 40_000, :to => 50_000)).
239
- to_return(:status => 202,
240
- :body => %q({"id":"vol-12345","size": 50000}),
241
- :headers => {})
234
+ stub_request(:post, "http://localhost/1.0/volumes/vol-12345/resize")
235
+ .with(query: hash_including(:account_id),
236
+ headers: { "Authorization" => "Bearer FAKECACHEDTOKEN",
237
+ "Content-Type" => "application/json" },
238
+ body: hash_including(from: 40_000, to: 50_000))
239
+ .to_return(status: 202,
240
+ body: '{"id":"vol-12345","size": 50000}',
241
+ headers: {})
242
242
 
243
243
  subject.resize(to: 50_000)
244
244
 
@@ -261,7 +261,7 @@ describe Fog::Brightbox::Compute::Volume do
261
261
  image_id: "img-12345"
262
262
  }
263
263
 
264
- @volume = Fog::Brightbox::Compute::Volume.new({ :service => service }.merge(options))
264
+ @volume = Fog::Brightbox::Compute::Volume.new({ service: service }.merge(options))
265
265
 
266
266
  assert_raises Fog::Errors::Error do
267
267
  @volume.save
@@ -276,16 +276,16 @@ describe Fog::Brightbox::Compute::Volume do
276
276
  filesystem_type: "ext4"
277
277
  }
278
278
 
279
- stub_request(:post, "http://localhost/1.0/volumes").
280
- with(:query => hash_including(:account_id),
281
- :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN",
282
- "Content-Type" => "application/json" },
283
- :body => hash_including(:filesystem_type => "ext4")).
284
- to_return(:status => 202,
285
- :body => %q({"id":"vol-12345","image":{"id":"img-blank"}}),
286
- :headers => {})
279
+ stub_request(:post, "http://localhost/1.0/volumes")
280
+ .with(query: hash_including(:account_id),
281
+ headers: { "Authorization" => "Bearer FAKECACHEDTOKEN",
282
+ "Content-Type" => "application/json" },
283
+ body: hash_including(filesystem_type: "ext4"))
284
+ .to_return(status: 202,
285
+ body: '{"id":"vol-12345","image":{"id":"img-blank"}}',
286
+ headers: {})
287
287
 
288
- @volume = Fog::Brightbox::Compute::Volume.new({ :service => service }.merge(options))
288
+ @volume = Fog::Brightbox::Compute::Volume.new({ service: service }.merge(options))
289
289
  assert @volume.save
290
290
  assert_equal @volume.filesystem_type, "ext4"
291
291
  assert_equal @volume.image_id, "img-blank"
@@ -300,17 +300,16 @@ describe Fog::Brightbox::Compute::Volume do
300
300
  name: "My Volume"
301
301
  }
302
302
 
303
- stub_request(:post, "http://localhost/1.0/volumes").
304
- with(:query => hash_including(:account_id),
305
- :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN",
306
- "Content-Type" => "application/json" },
307
- :body => hash_including(:image => "img-12345")).
308
- to_return(:status => 202,
309
- :body => %q({"id":"vol-12345","image":{"id":"img-12345"}}),
310
- :headers => {})
311
-
303
+ stub_request(:post, "http://localhost/1.0/volumes")
304
+ .with(query: hash_including(:account_id),
305
+ headers: { "Authorization" => "Bearer FAKECACHEDTOKEN",
306
+ "Content-Type" => "application/json" },
307
+ body: hash_including(image: "img-12345"))
308
+ .to_return(status: 202,
309
+ body: '{"id":"vol-12345","image":{"id":"img-12345"}}',
310
+ headers: {})
312
311
 
313
- @volume = Fog::Brightbox::Compute::Volume.new({ :service => service }.merge(options))
312
+ @volume = Fog::Brightbox::Compute::Volume.new({ service: service }.merge(options))
314
313
  assert @volume.save
315
314
  assert_equal @volume.image_id, "img-12345"
316
315
  assert_equal @volume.name, "My Volume"
@@ -329,17 +328,17 @@ describe Fog::Brightbox::Compute::Volume do
329
328
  subject.name = "New name"
330
329
  subject.serial = "NewSerial"
331
330
 
332
- stub_request(:put, "http://localhost/1.0/volumes/vol-12345").
333
- with(:query => hash_including(:account_id),
334
- :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN",
335
- "Content-Type" => "application/json" },
336
- :body => hash_including(:delete_with_server => true,
337
- :description => "Updated description",
338
- :name => "New name",
339
- :serial => "NewSerial")).
340
- to_return(:status => 202,
341
- :body => %q({"id":"vol-12345"}),
342
- :headers => {})
331
+ stub_request(:put, "http://localhost/1.0/volumes/vol-12345")
332
+ .with(query: hash_including(:account_id),
333
+ headers: { "Authorization" => "Bearer FAKECACHEDTOKEN",
334
+ "Content-Type" => "application/json" },
335
+ body: hash_including(delete_with_server: true,
336
+ description: "Updated description",
337
+ name: "New name",
338
+ serial: "NewSerial"))
339
+ .to_return(status: 202,
340
+ body: '{"id":"vol-12345"}',
341
+ headers: {})
343
342
 
344
343
  subject.save
345
344
  end