fog-aws 3.3.0 → 3.4.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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +10 -12
  3. data/fog-aws.gemspec +1 -1
  4. data/lib/fog/aws/compute.rb +2 -0
  5. data/lib/fog/aws/models/compute/address.rb +1 -0
  6. data/lib/fog/aws/models/compute/flavors.rb +440 -0
  7. data/lib/fog/aws/models/rds/cluster.rb +9 -1
  8. data/lib/fog/aws/models/rds/server.rb +3 -3
  9. data/lib/fog/aws/models/storage/directory.rb +35 -0
  10. data/lib/fog/aws/parsers/compute/describe_addresses.rb +30 -9
  11. data/lib/fog/aws/parsers/compute/describe_image_attribute.rb +122 -0
  12. data/lib/fog/aws/parsers/compute/describe_security_groups.rb +1 -1
  13. data/lib/fog/aws/requests/compute/describe_image_attribute.rb +74 -0
  14. data/lib/fog/aws/requests/compute/describe_security_groups.rb +12 -1
  15. data/lib/fog/aws/requests/compute/modify_instance_placement.rb +33 -0
  16. data/lib/fog/aws/requests/dns/change_resource_record_sets.rb +1 -1
  17. data/lib/fog/aws/requests/dynamodb/update_item.rb +6 -5
  18. data/lib/fog/aws/requests/storage/get_bucket_location.rb +2 -3
  19. data/lib/fog/aws/requests/storage/get_service.rb +2 -2
  20. data/lib/fog/aws/requests/storage/put_object.rb +5 -3
  21. data/lib/fog/aws/storage.rb +9 -2
  22. data/lib/fog/aws/version.rb +1 -1
  23. data/tests/credentials_tests.rb +38 -37
  24. data/tests/helper.rb +2 -2
  25. data/tests/helpers/collection_helper.rb +3 -4
  26. data/tests/helpers/compute/flavors_helper.rb +1 -5
  27. data/tests/helpers/compute/server_helper.rb +1 -3
  28. data/tests/helpers/compute/servers_helper.rb +0 -2
  29. data/tests/helpers/dns_helper.rb +32 -31
  30. data/tests/helpers/formats_helper.rb +58 -56
  31. data/tests/helpers/formats_helper_tests.rb +22 -25
  32. data/tests/helpers/mock_helper.rb +96 -96
  33. data/tests/helpers/model_helper.rb +4 -5
  34. data/tests/helpers/responds_to_helper.rb +1 -1
  35. data/tests/helpers/schema_validator_tests.rb +21 -24
  36. data/tests/helpers/succeeds_helper.rb +1 -1
  37. data/tests/parsers/compute/describe_images_tests.rb +1 -1
  38. data/tests/parsers/elb/describe_load_balancers.rb +1 -1
  39. data/tests/requests/compute/image_tests.rb +9 -0
  40. data/tests/requests/sts/assume_role_with_web_identity_tests.rb +2 -0
  41. data/tests/signaturev4_tests.rb +21 -22
  42. data/tests/signed_params_tests.rb +7 -7
  43. data/tests/storage_tests.rb +1 -1
  44. metadata +8 -6
@@ -1,37 +1,37 @@
1
1
  Shindo.tests('test_helper', 'meta') do
2
2
 
3
3
  tests('comparing welcome data against schema') do
4
- data = {:welcome => "Hello" }
5
- data_matches_schema(:welcome => String) { data }
4
+ data = { welcome: 'Hello' }
5
+ data_matches_schema(welcome: String) { data }
6
6
  end
7
7
 
8
8
  tests('#data_matches_schema') do
9
9
  tests('when value matches schema expectation') do
10
- data_matches_schema({"key" => String}) { {"key" => "Value"} }
10
+ data_matches_schema('key' => String) { { 'key' => 'Value' } }
11
11
  end
12
12
 
13
13
  tests('when values within an array all match schema expectation') do
14
- data_matches_schema({"key" => [Integer]}) { {"key" => [1, 2]} }
14
+ data_matches_schema('key' => [Integer]) { { 'key' => [1, 2] } }
15
15
  end
16
16
 
17
17
  tests('when nested values match schema expectation') do
18
- data_matches_schema({"key" => {:nested_key => String}}) { {"key" => {:nested_key => "Value"}} }
18
+ data_matches_schema('key' => { nested_key: String }) { { 'key' => { nested_key: 'Value' } } }
19
19
  end
20
20
 
21
21
  tests('when collection of values all match schema expectation') do
22
- data_matches_schema([{"key" => String}]) { [{"key" => "Value"}, {"key" => "Value"}] }
22
+ data_matches_schema([{ 'key' => String }]) { [{ 'key' => 'Value' }, { 'key' => 'Value' }] }
23
23
  end
24
24
 
25
25
  tests('when collection is empty although schema covers optional members') do
26
- data_matches_schema([{"key" => String}], {:allow_optional_rules => true}) { [] }
26
+ data_matches_schema([{ 'key' => String }], allow_optional_rules: true) { [] }
27
27
  end
28
28
 
29
29
  tests('when additional keys are passed and not strict') do
30
- data_matches_schema({"key" => String}, {:allow_extra_keys => true}) { {"key" => "Value", :extra => "Bonus"} }
30
+ data_matches_schema({ 'key' => String }, allow_extra_keys: true) { { 'key' => 'Value', extra: 'Bonus' } }
31
31
  end
32
32
 
33
33
  tests('when value is nil and schema expects NilClass') do
34
- data_matches_schema({"key" => NilClass}) { {"key" => nil} }
34
+ data_matches_schema('key' => NilClass) { { 'key' => nil } }
35
35
  end
36
36
 
37
37
  tests('when value and schema match as hashes') do
@@ -43,46 +43,45 @@ Shindo.tests('test_helper', 'meta') do
43
43
  end
44
44
 
45
45
  tests('when value is a Time') do
46
- data_matches_schema({"time" => Time}) { {"time" => Time.now} }
46
+ data_matches_schema('time' => Time) { { 'time' => Time.now } }
47
47
  end
48
48
 
49
49
  tests('when key is missing but value should be NilClass (#1477)') do
50
- data_matches_schema({"key" => NilClass}, {:allow_optional_rules => true}) { {} }
50
+ data_matches_schema({ 'key' => NilClass }, allow_optional_rules: true) { {} }
51
51
  end
52
52
 
53
53
  tests('when key is missing but value is nullable (#1477)') do
54
- data_matches_schema({"key" => Fog::Nullable::String}, {:allow_optional_rules => true}) { {} }
54
+ data_matches_schema({ 'key' => Fog::Nullable::String }, allow_optional_rules: true) { {} }
55
55
  end
56
56
  end
57
57
 
58
58
  tests('#formats backwards compatible changes') do
59
-
60
59
  tests('when value matches schema expectation') do
61
- formats({"key" => String}) { {"key" => "Value"} }
60
+ formats('key' => String) { { 'key' => 'Value' } }
62
61
  end
63
62
 
64
63
  tests('when values within an array all match schema expectation') do
65
- formats({"key" => [Integer]}) { {"key" => [1, 2]} }
64
+ formats('key' => [Integer]) { { 'key' => [1, 2] } }
66
65
  end
67
66
 
68
67
  tests('when nested values match schema expectation') do
69
- formats({"key" => {:nested_key => String}}) { {"key" => {:nested_key => "Value"}} }
68
+ formats('key' => { nested_key: String }) { { 'key' => { nested_key: 'Value' } } }
70
69
  end
71
70
 
72
71
  tests('when collection of values all match schema expectation') do
73
- formats([{"key" => String}]) { [{"key" => "Value"}, {"key" => "Value"}] }
72
+ formats([{ 'key' => String }]) { [{ 'key' => 'Value' }, { 'key' => 'Value' }] }
74
73
  end
75
74
 
76
75
  tests('when collection is empty although schema covers optional members') do
77
- formats([{"key" => String}]) { [] }
76
+ formats([{ 'key' => String }]) { [] }
78
77
  end
79
78
 
80
79
  tests('when additional keys are passed and not strict') do
81
- formats({"key" => String}, false) { {"key" => "Value", :extra => "Bonus"} }
80
+ formats({ 'key' => String }, false) { { 'key' => 'Value', :extra => 'Bonus' } }
82
81
  end
83
82
 
84
83
  tests('when value is nil and schema expects NilClass') do
85
- formats({"key" => NilClass}) { {"key" => nil} }
84
+ formats('key' => NilClass) { { 'key' => nil } }
86
85
  end
87
86
 
88
87
  tests('when value and schema match as hashes') do
@@ -94,17 +93,15 @@ Shindo.tests('test_helper', 'meta') do
94
93
  end
95
94
 
96
95
  tests('when value is a Time') do
97
- formats({"time" => Time}) { {"time" => Time.now} }
96
+ formats('time' => Time) { { 'time' => Time.now } }
98
97
  end
99
98
 
100
99
  tests('when key is missing but value should be NilClass (#1477)') do
101
- formats({"key" => NilClass}) { {} }
100
+ formats('key' => NilClass) { {} }
102
101
  end
103
102
 
104
103
  tests('when key is missing but value is nullable (#1477)') do
105
- formats({"key" => Fog::Nullable::String}) { {} }
104
+ formats('key' => Fog::Nullable::String) { {} }
106
105
  end
107
-
108
106
  end
109
-
110
107
  end
@@ -9,101 +9,101 @@ end
9
9
  # if in mocked mode, fill in some fake credentials for us
10
10
  if Fog.mock?
11
11
  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
- :google_storage_access_key_id => 'google_storage_access_key_id',
40
- :google_storage_secret_access_key => 'google_storage_secret_access_key',
41
- :google_project => 'google_project_name',
42
- :google_client_email => 'fake@developer.gserviceaccount.com',
43
- :google_key_location => '~/fake.p12',
44
- :hp_access_key => 'hp_access_key',
45
- :hp_secret_key => 'hp_secret_key',
46
- :hp_tenant_id => 'hp_tenant_id',
47
- :hp_avl_zone => 'hp_avl_zone',
48
- :os_account_meta_temp_url_key => 'os_account_meta_temp_url_key',
49
- :ibm_username => 'ibm_username',
50
- :ibm_password => 'ibm_password',
51
- :joyent_username => "joyentuser",
52
- :joyent_password => "joyentpass",
53
- :linode_api_key => 'linode_api_key',
54
- :local_root => '~/.fog',
55
- :bare_metal_cloud_password => 'bare_metal_cloud_password',
56
- :bare_metal_cloud_username => 'bare_metal_cloud_username',
57
- :ninefold_compute_key => 'ninefold_compute_key',
58
- :ninefold_compute_secret => 'ninefold_compute_secret',
59
- :ninefold_storage_secret => 'ninefold_storage_secret',
60
- :ninefold_storage_token => 'ninefold_storage_token',
61
- # :public_key_path => '~/.ssh/id_rsa.pub',
62
- # :private_key_path => '~/.ssh/id_rsa',
63
- :opennebula_endpoint => 'http://opennebula:2633/RPC2',
64
- :opennebula_username => 'oneadmin',
65
- :opennebula_password => 'oneadmin',
66
- :openstack_api_key => 'openstack_api_key',
67
- :openstack_username => 'openstack_username',
68
- :openstack_tenant => 'openstack_tenant',
69
- :openstack_auth_url => 'http://openstack:35357/v2.0/tokens',
70
- :ovirt_url => 'http://ovirt:8080/api',
71
- :ovirt_username => 'admin@internal',
72
- :ovirt_password => '123123',
73
- :profitbricks_username => 'profitbricks_username',
74
- :profitbricks_password => 'profitbricks_password',
75
- :libvirt_uri => 'qemu://libvirt/system',
76
- :rackspace_api_key => 'rackspace_api_key',
77
- :rackspace_region => 'dfw',
78
- :rackspace_username => 'rackspace_username',
79
- :riakcs_access_key_id => 'riakcs_access_key_id',
80
- :riakcs_secret_access_key => 'riakcs_secret_access_key',
81
- :sakuracloud_api_token => 'sakuracloud_api_token',
82
- :sakuracloud_api_token_secret => 'sakuracloud_api_token_secret',
83
- :storm_on_demand_username => 'storm_on_demand_username',
84
- :storm_on_demand_password => 'storm_on_demand_password',
85
- :vcloud_host => 'vcloud_host',
86
- :vcloud_password => 'vcloud_password',
87
- :vcloud_username => 'vcloud_username',
88
- :vcloud_director_host => 'vcloud-director-host',
89
- :vcloud_director_password => 'vcloud_director_password',
90
- :vcloud_director_username => 'vcd_user@vcd_org_name',
91
- :zerigo_email => 'zerigo_email',
92
- :zerigo_token => 'zerigo_token',
93
- :dynect_customer => 'dynect_customer',
94
- :dynect_username => 'dynect_username',
95
- :dynect_password => 'dynect_password',
96
- :vsphere_server => 'virtualcenter.lan',
97
- :vsphere_username => 'apiuser',
98
- :vsphere_password => 'apipassword',
99
- :vsphere_expected_pubkey_hash => 'abcdef1234567890',
100
- :libvirt_username => 'root',
101
- :libvirt_password => 'password',
102
- :cloudsigma_username => 'csuname',
103
- :cloudsigma_password => 'cspass',
104
- :docker_username => 'docker-fan',
105
- :docker_password => 'i<3docker',
106
- :docker_email => 'dockerfan@gmail.com',
107
- :docker_url => 'unix://var/run/docker.sock'
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
+ google_storage_access_key_id: 'google_storage_access_key_id',
40
+ google_storage_secret_access_key: 'google_storage_secret_access_key',
41
+ google_project: 'google_project_name',
42
+ google_client_email: 'fake@developer.gserviceaccount.com',
43
+ google_key_location: '~/fake.p12',
44
+ hp_access_key: 'hp_access_key',
45
+ hp_secret_key: 'hp_secret_key',
46
+ hp_tenant_id: 'hp_tenant_id',
47
+ hp_avl_zone: 'hp_avl_zone',
48
+ os_account_meta_temp_url_key: 'os_account_meta_temp_url_key',
49
+ ibm_username: 'ibm_username',
50
+ ibm_password: 'ibm_password',
51
+ joyent_username: 'joyentuser',
52
+ joyent_password: 'joyentpass',
53
+ linode_api_key: 'linode_api_key',
54
+ local_root: '~/.fog',
55
+ bare_metal_cloud_password: 'bare_metal_cloud_password',
56
+ bare_metal_cloud_username: 'bare_metal_cloud_username',
57
+ ninefold_compute_key: 'ninefold_compute_key',
58
+ ninefold_compute_secret: 'ninefold_compute_secret',
59
+ ninefold_storage_secret: 'ninefold_storage_secret',
60
+ ninefold_storage_token: 'ninefold_storage_token',
61
+ # public_key_path: '~/.ssh/id_rsa.pub',
62
+ # private_key_path: '~/.ssh/id_rsa',
63
+ opennebula_endpoint: 'http://opennebula:2633/RPC2',
64
+ opennebula_username: 'oneadmin',
65
+ opennebula_password: 'oneadmin',
66
+ openstack_api_key: 'openstack_api_key',
67
+ openstack_username: 'openstack_username',
68
+ openstack_tenant: 'openstack_tenant',
69
+ openstack_auth_url: 'http://openstack:35357/v2.0/tokens',
70
+ ovirt_url: 'http://ovirt:8080/api',
71
+ ovirt_username: 'admin@internal',
72
+ ovirt_password: '123123',
73
+ profitbricks_username: 'profitbricks_username',
74
+ profitbricks_password: 'profitbricks_password',
75
+ libvirt_uri: 'qemu://libvirt/system',
76
+ rackspace_api_key: 'rackspace_api_key',
77
+ rackspace_region: 'dfw',
78
+ rackspace_username: 'rackspace_username',
79
+ riakcs_access_key_id: 'riakcs_access_key_id',
80
+ riakcs_secret_access_key: 'riakcs_secret_access_key',
81
+ sakuracloud_api_token: 'sakuracloud_api_token',
82
+ sakuracloud_api_token_secret: 'sakuracloud_api_token_secret',
83
+ storm_on_demand_username: 'storm_on_demand_username',
84
+ storm_on_demand_password: 'storm_on_demand_password',
85
+ vcloud_host: 'vcloud_host',
86
+ vcloud_password: 'vcloud_password',
87
+ vcloud_username: 'vcloud_username',
88
+ vcloud_director_host: 'vcloud-director-host',
89
+ vcloud_director_password: 'vcloud_director_password',
90
+ vcloud_director_username: 'vcd_user@vcd_org_name',
91
+ zerigo_email: 'zerigo_email',
92
+ zerigo_token: 'zerigo_token',
93
+ dynect_customer: 'dynect_customer',
94
+ dynect_username: 'dynect_username',
95
+ dynect_password: 'dynect_password',
96
+ vsphere_server: 'virtualcenter.lan',
97
+ vsphere_username: 'apiuser',
98
+ vsphere_password: 'apipassword',
99
+ vsphere_expected_pubkey_hash: 'abcdef1234567890',
100
+ libvirt_username: 'root',
101
+ libvirt_password: 'password',
102
+ cloudsigma_username: 'csuname',
103
+ cloudsigma_password: 'cspass',
104
+ docker_username: 'docker-fan',
105
+ docker_password: 'i<3docker',
106
+ docker_email: 'dockerfan@gmail.com',
107
+ docker_url: 'unix://var/run/docker.sock'
108
108
  }.merge(Fog.credentials)
109
109
  end
@@ -1,9 +1,8 @@
1
1
  def model_tests(collection, params = {}, mocks_implemented = true)
2
2
  tests('success') do
3
-
4
3
  @instance = collection.new(params)
5
4
 
6
- tests("#save").succeeds do
5
+ tests('#save').succeeds do
7
6
  pending if Fog.mocking? && !mocks_implemented
8
7
  @instance.save
9
8
  end
@@ -12,7 +11,7 @@ def model_tests(collection, params = {}, mocks_implemented = true)
12
11
  yield(@instance)
13
12
  end
14
13
 
15
- tests("#destroy").succeeds do
14
+ tests('#destroy').succeeds do
16
15
  pending if Fog.mocking? && !mocks_implemented
17
16
  @instance.destroy
18
17
  end
@@ -26,6 +25,6 @@ end
26
25
  # E.g. 'fog-test-1234'
27
26
  def uniq_id(base_name = 'fog-test')
28
27
  # random_differentiator
29
- suffix = rand(65536).to_s(16).rjust(4, '0')
30
- [base_name, suffix] * '-'
28
+ suffix = rand(65_536).to_s(16).rjust(4, '0')
29
+ [base_name, suffix].join('-')
31
30
  end
@@ -1,7 +1,7 @@
1
1
  module Shindo
2
2
  class Tests
3
3
  def responds_to(method_names)
4
- for method_name in [*method_names]
4
+ [*method_names].each do |method_name|
5
5
  tests("#respond_to?(:#{method_name})").returns(true) do
6
6
  @instance.respond_to?(method_name)
7
7
  end
@@ -1,37 +1,37 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Shindo.tests('Fog::Schema::DataValidator', 'meta') do
2
4
 
3
5
  validator = Fog::Schema::DataValidator.new
4
6
 
5
7
  tests('#validate') do
6
-
7
8
  tests('returns true') do
8
-
9
9
  returns(true, 'when value matches schema expectation') do
10
- validator.validate({"key" => "Value"}, {"key" => String})
10
+ validator.validate({ 'key' => 'Value' }, 'key' => String)
11
11
  end
12
12
 
13
13
  returns(true, 'when values within an array all match schema expectation') do
14
- validator.validate({"key" => [1, 2]}, {"key" => [Integer]})
14
+ validator.validate({ 'key' => [1, 2] }, 'key' => [Integer])
15
15
  end
16
16
 
17
17
  returns(true, 'when nested values match schema expectation') do
18
- validator.validate({"key" => {:nested_key => "Value"}}, {"key" => {:nested_key => String}})
18
+ validator.validate({ 'key' => { nested_key: 'Value' } }, 'key' => { nested_key: String })
19
19
  end
20
20
 
21
21
  returns(true, 'when collection of values all match schema expectation') do
22
- validator.validate([{"key" => "Value"}, {"key" => "Value"}], [{"key" => String}])
22
+ validator.validate([{ 'key' => 'Value' }, 'key' => 'Value'], [{ 'key' => String }])
23
23
  end
24
24
 
25
25
  returns(true, 'when collection is empty although schema covers optional members') do
26
- validator.validate([], [{"key" => String}])
26
+ validator.validate([], [{ 'key' => String }])
27
27
  end
28
28
 
29
29
  returns(true, 'when additional keys are passed and not strict') do
30
- validator.validate({"key" => "Value", :extra => "Bonus"}, {"key" => String}, {:allow_extra_keys => true})
30
+ validator.validate({ 'key' => 'Value', extra: 'Bonus' }, { 'key' => String }, allow_extra_keys: true)
31
31
  end
32
32
 
33
33
  returns(true, 'when value is nil and schema expects NilClass') do
34
- validator.validate({"key" => nil}, {"key" => NilClass})
34
+ validator.validate({ 'key' => nil }, 'key' => NilClass)
35
35
  end
36
36
 
37
37
  returns(true, 'when value and schema match as hashes') do
@@ -43,43 +43,41 @@ Shindo.tests('Fog::Schema::DataValidator', 'meta') do
43
43
  end
44
44
 
45
45
  returns(true, 'when value is a Time') do
46
- validator.validate({"time" => Time.now}, {"time" => Time})
46
+ validator.validate({ 'time' => Time.now }, 'time' => Time)
47
47
  end
48
48
 
49
49
  returns(true, 'when key is missing but value should be NilClass (#1477)') do
50
- validator.validate({}, {"key" => NilClass}, {:allow_optional_rules => true})
50
+ validator.validate({}, { 'key' => NilClass }, allow_optional_rules: true)
51
51
  end
52
52
 
53
53
  returns(true, 'when key is missing but value is nullable (#1477)') do
54
- validator.validate({}, {"key" => Fog::Nullable::String}, {:allow_optional_rules => true})
54
+ validator.validate({}, { 'key' => Fog::Nullable::String }, allow_optional_rules: true)
55
55
  end
56
-
57
56
  end
58
57
 
59
58
  tests('returns false') do
60
-
61
59
  returns(false, 'when value does not match schema expectation') do
62
- validator.validate({"key" => nil}, {"key" => String})
60
+ validator.validate({ 'key' => nil }, 'key' => String)
63
61
  end
64
62
 
65
63
  returns(false, 'when key formats do not match') do
66
- validator.validate({"key" => "Value"}, {:key => String})
64
+ validator.validate({ 'key' => 'Value' }, key: String)
67
65
  end
68
66
 
69
67
  returns(false, 'when additional keys are passed and strict') do
70
- validator.validate({"key" => "Missing"}, {})
68
+ validator.validate({ 'key' => 'Missing' }, {})
71
69
  end
72
70
 
73
71
  returns(false, 'when some keys do not appear') do
74
- validator.validate({}, {"key" => String})
72
+ validator.validate({}, 'key' => String)
75
73
  end
76
74
 
77
75
  returns(false, 'when collection contains a member that does not match schema') do
78
- validator.validate([{"key" => "Value"}, {"key" => 5}], [{"key" => String}])
76
+ validator.validate([{ 'key' => 'Value' }, 'key' => 5], ['key' => String])
79
77
  end
80
78
 
81
79
  returns(false, 'when collection has multiple schema patterns') do
82
- validator.validate([{"key" => "Value"}], [{"key" => Integer}, {"key" => String}])
80
+ validator.validate([{ 'key' => 'Value' }], [{ 'key' => Integer }, { 'key' => String }])
83
81
  end
84
82
 
85
83
  returns(false, 'when hash and array are compared') do
@@ -91,17 +89,16 @@ Shindo.tests('Fog::Schema::DataValidator', 'meta') do
91
89
  end
92
90
 
93
91
  returns(false, 'when a hash is expected but another data type is found') do
94
- validator.validate({"key" => {:nested_key => []}}, {"key" => {:nested_key => {}}})
92
+ validator.validate({ 'key' => { nested_key: [] } }, 'key' => { nested_key: {} })
95
93
  end
96
94
 
97
95
  returns(false, 'when key is missing but value should be NilClass (#1477)') do
98
- validator.validate({}, {"key" => NilClass}, {:allow_optional_rules => false})
96
+ validator.validate({}, { 'key' => NilClass }, allow_optional_rules: false)
99
97
  end
100
98
 
101
99
  returns(false, 'when key is missing but value is nullable (#1477)') do
102
- validator.validate({}, {"key" => Fog::Nullable::String}, {:allow_optional_rules => false})
100
+ validator.validate({}, { 'key' => Fog::Nullable::String }, allow_optional_rules: false)
103
101
  end
104
-
105
102
  end
106
103
  end
107
104
  end