fog 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/fog.gemspec +1 -1
  2. data/lib/fog.rb +15 -4
  3. data/lib/fog/aws/ec2.rb +10 -2
  4. data/lib/fog/aws/models/ec2/addresses.rb +1 -1
  5. data/lib/fog/aws/models/ec2/images.rb +1 -1
  6. data/lib/fog/aws/models/ec2/key_pairs.rb +1 -1
  7. data/lib/fog/aws/models/ec2/security_groups.rb +1 -1
  8. data/lib/fog/aws/models/ec2/servers.rb +1 -1
  9. data/lib/fog/aws/models/ec2/snapshots.rb +1 -1
  10. data/lib/fog/aws/models/ec2/volumes.rb +1 -1
  11. data/lib/fog/aws/requests/ec2/describe_reserved_instances.rb +1 -1
  12. data/lib/fog/aws/requests/ec2/modify_image_attributes.rb +1 -1
  13. data/lib/fog/aws/requests/elb/create_load_balancer.rb +1 -1
  14. data/lib/fog/aws/requests/elb/delete_load_balancer.rb +1 -1
  15. data/lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb +1 -1
  16. data/lib/fog/aws/requests/elb/describe_instance_health.rb +1 -1
  17. data/lib/fog/aws/requests/elb/describe_load_balancers.rb +1 -1
  18. data/lib/fog/aws/requests/elb/disable_availability_zones_for_load_balancer.rb +1 -1
  19. data/lib/fog/aws/requests/elb/enable_availability_zones_for_load_balancer.rb +1 -1
  20. data/lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb +1 -1
  21. data/lib/fog/aws/requests/s3/get_bucket_acl.rb +1 -1
  22. data/lib/fog/aws/requests/s3/get_bucket_logging.rb +1 -1
  23. data/lib/fog/aws/requests/s3/get_bucket_object_versions.rb +1 -1
  24. data/lib/fog/aws/requests/s3/get_bucket_versioning.rb +1 -1
  25. data/lib/fog/aws/requests/s3/get_object_acl.rb +1 -1
  26. data/lib/fog/aws/requests/s3/get_object_torrent.rb +1 -1
  27. data/lib/fog/aws/requests/s3/put_bucket_acl.rb +1 -1
  28. data/lib/fog/aws/requests/s3/put_bucket_logging.rb +1 -1
  29. data/lib/fog/aws/requests/s3/put_bucket_versioning.rb +1 -1
  30. data/lib/fog/aws/requests/simpledb/select.rb +1 -1
  31. data/lib/fog/rackspace/requests/files/delete_container.rb +1 -1
  32. data/lib/fog/rackspace/requests/files/delete_object.rb +1 -1
  33. data/lib/fog/rackspace/requests/files/get_container.rb +1 -1
  34. data/lib/fog/rackspace/requests/files/get_containers.rb +1 -1
  35. data/lib/fog/rackspace/requests/files/get_object.rb +1 -1
  36. data/lib/fog/rackspace/requests/files/head_container.rb +1 -1
  37. data/lib/fog/rackspace/requests/files/head_containers.rb +1 -1
  38. data/lib/fog/rackspace/requests/files/head_object.rb +1 -1
  39. data/lib/fog/rackspace/requests/files/put_container.rb +1 -1
  40. data/lib/fog/rackspace/requests/files/put_object.rb +1 -1
  41. data/lib/fog/rackspace/requests/servers/get_flavor_details.rb +1 -1
  42. data/lib/fog/rackspace/requests/servers/get_image_details.rb +1 -1
  43. data/lib/fog/rackspace/requests/servers/list_flavors.rb +1 -1
  44. data/lib/fog/rackspace/requests/servers/list_flavors_detail.rb +1 -1
  45. data/lib/fog/rackspace/requests/servers/reboot_server.rb +1 -1
  46. data/lib/fog/slicehost/requests/create_slice.rb +1 -1
  47. data/lib/fog/slicehost/requests/delete_slice.rb +1 -1
  48. data/lib/fog/slicehost/requests/get_backups.rb +1 -1
  49. data/lib/fog/slicehost/requests/get_flavor.rb +1 -1
  50. data/lib/fog/slicehost/requests/get_flavors.rb +1 -1
  51. data/lib/fog/slicehost/requests/get_image.rb +1 -1
  52. data/lib/fog/slicehost/requests/get_images.rb +1 -1
  53. data/lib/fog/slicehost/requests/get_slice.rb +1 -1
  54. data/lib/fog/slicehost/requests/get_slices.rb +1 -1
  55. data/lib/fog/slicehost/requests/reboot_slice.rb +1 -1
  56. data/lib/fog/ssh.rb +1 -1
  57. data/lib/fog/terremark/requests/shared/add_internet_service.rb +1 -1
  58. data/lib/fog/terremark/requests/shared/add_node_service.rb +1 -1
  59. data/lib/fog/terremark/requests/shared/create_internet_service.rb +1 -1
  60. data/lib/fog/terremark/requests/shared/delete_internet_service.rb +1 -1
  61. data/lib/fog/terremark/requests/shared/delete_node_service.rb +1 -1
  62. data/lib/fog/terremark/requests/shared/delete_public_ip.rb +1 -1
  63. data/lib/fog/terremark/requests/shared/delete_vapp.rb +1 -1
  64. data/lib/fog/terremark/requests/shared/deploy_vapp.rb +1 -1
  65. data/lib/fog/terremark/requests/shared/get_catalog.rb +1 -1
  66. data/lib/fog/terremark/requests/shared/get_catalog_item.rb +1 -1
  67. data/lib/fog/terremark/requests/shared/get_internet_services.rb +1 -1
  68. data/lib/fog/terremark/requests/shared/get_network_ips.rb +1 -1
  69. data/lib/fog/terremark/requests/shared/get_node_services.rb +1 -1
  70. data/lib/fog/terremark/requests/shared/get_public_ip.rb +1 -1
  71. data/lib/fog/terremark/requests/shared/get_task.rb +1 -1
  72. data/lib/fog/terremark/requests/shared/get_tasks_list.rb +1 -1
  73. data/lib/fog/terremark/requests/shared/get_vapp.rb +1 -1
  74. data/lib/fog/terremark/requests/shared/get_vapp_template.rb +1 -1
  75. data/lib/fog/terremark/requests/shared/instantiate_vapp_template.rb +1 -1
  76. data/lib/fog/terremark/requests/shared/power_off.rb +1 -1
  77. data/lib/fog/terremark/requests/shared/power_on.rb +1 -1
  78. data/lib/fog/terremark/requests/shared/power_reset.rb +1 -1
  79. data/lib/fog/terremark/requests/shared/power_shutdown.rb +1 -1
  80. data/tests/aws/helper.rb +0 -89
  81. data/tests/aws/requests/ec2/address_tests.rb +10 -2
  82. data/tests/aws/requests/ec2/availability_zone_tests.rb +11 -2
  83. data/tests/aws/requests/ec2/key_pair_tests.rb +18 -3
  84. data/tests/aws/requests/ec2/region_tests.rb +10 -2
  85. data/tests/aws/requests/ec2/security_group_tests.rb +18 -2
  86. data/tests/aws/requests/ec2/snapshot_tests.rb +21 -4
  87. data/tests/aws/requests/ec2/volume_tests.rb +43 -8
  88. data/tests/helper_tests.rb +7 -36
  89. metadata +2 -2
@@ -1,5 +1,13 @@
1
1
  Shindo.tests('AWS::EC2 | address requests', ['aws']) do
2
2
 
3
+ @addresses_format = {
4
+ 'addressesSet' => [{
5
+ 'instanceId' => NilClass,
6
+ 'publicIp' => String
7
+ }],
8
+ 'requestId' => String
9
+ }
10
+
3
11
  @server = AWS[:ec2].servers.create(:image_id => GENTOO_AMI)
4
12
  @server.wait_for { ready? }
5
13
  @ip_address = @server.ip_address
@@ -14,11 +22,11 @@ Shindo.tests('AWS::EC2 | address requests', ['aws']) do
14
22
  data
15
23
  end
16
24
 
17
- tests('#describe_addresses').formats(AWS::EC2::Formats::ADDRESSES) do
25
+ tests('#describe_addresses').formats(@addresses_format) do
18
26
  AWS[:ec2].describe_addresses.body
19
27
  end
20
28
 
21
- tests("#describe_addresses('#{@public_Ip}')").formats(AWS::EC2::Formats::ADDRESSES) do
29
+ tests("#describe_addresses('#{@public_Ip}')").formats(@addresses_format) do
22
30
  AWS[:ec2].describe_addresses(@public_ip).body
23
31
  end
24
32
 
@@ -1,12 +1,21 @@
1
1
  Shindo.tests('AWS::EC2 | availability zone requests', ['aws']) do
2
2
 
3
+ @availability_zones_format = {
4
+ 'availabilityZoneInfo' => [{
5
+ 'regionName' => String,
6
+ 'zoneName' => String,
7
+ 'zoneState' => String
8
+ }],
9
+ 'requestId' => String
10
+ }
11
+
3
12
  tests('success') do
4
13
 
5
- tests('#describe_availability_zones').formats(AWS::EC2::Formats::AVAILABILITY_ZONES) do
14
+ tests('#describe_availability_zones').formats(@availability_zones_format) do
6
15
  AWS[:ec2].describe_availability_zones.body
7
16
  end
8
17
 
9
- tests("#describe_availability_zones('us-east-1a')").formats(AWS::EC2::Formats::AVAILABILITY_ZONES) do
18
+ tests("#describe_availability_zones('us-east-1a')").formats(@availability_zones_format) do
10
19
  AWS[:ec2].describe_availability_zones('us-east-1a').body
11
20
  end
12
21
 
@@ -2,17 +2,32 @@ Shindo.tests('AWS::EC2 | key pair requests', ['aws']) do
2
2
 
3
3
  tests('success') do
4
4
 
5
+ @keypair_format = {
6
+ 'keyFingerprint' => String,
7
+ 'keyMaterial' => String,
8
+ 'keyName' => String,
9
+ 'requestId' => String
10
+ }
11
+
12
+ @keypairs_format = {
13
+ 'keySet' => [{
14
+ 'keyFingerprint' => String,
15
+ 'keyName' => String
16
+ }],
17
+ 'requestId' => String
18
+ }
19
+
5
20
  @key_pair_name = 'fog_key_pair'
6
21
 
7
- tests("#create_key_pair('#{@key_pair_name}')").formats({ 'keyFingerprint' => String, 'keyMaterial' => String, 'keyName' => String, 'requestId' => String }) do
22
+ tests("#create_key_pair('#{@key_pair_name}')").formats(@keypair_format) do
8
23
  AWS[:ec2].create_key_pair(@key_pair_name).body
9
24
  end
10
25
 
11
- tests('#describe_key_pairs').formats({ 'keySet' => [{'keyFingerprint' => String, 'keyName' => String}], 'requestId' => String }) do
26
+ tests('#describe_key_pairs').formats(@keypairs_format) do
12
27
  AWS[:ec2].describe_key_pairs.body
13
28
  end
14
29
 
15
- tests("#describe_key_pairs(#{@key_pair_name})").formats({ 'keySet' => [{'keyFingerprint' => String, 'keyName' => String}], 'requestId' => String }) do
30
+ tests("#describe_key_pairs(#{@key_pair_name})").formats(@keypairs_format) do
16
31
  AWS[:ec2].describe_key_pairs(@key_pair_name).body
17
32
  end
18
33
 
@@ -1,12 +1,20 @@
1
1
  Shindo.tests('AWS::EC2 | region requests', ['aws']) do
2
2
 
3
+ @regions_format = {
4
+ 'regionInfo' => [{
5
+ 'regionEndpoint' => String,
6
+ 'regionName' => String
7
+ }],
8
+ 'requestId' => String
9
+ }
10
+
3
11
  tests('success') do
4
12
 
5
- tests("#describe_regions").formats(AWS::EC2::Formats::REGIONS) do
13
+ tests("#describe_regions").formats(@regions_format) do
6
14
  AWS[:ec2].describe_regions.body
7
15
  end
8
16
 
9
- tests("#describe_regions('us-east-1')").formats(AWS::EC2::Formats::REGIONS) do
17
+ tests("#describe_regions('us-east-1')").formats(@regions_format) do
10
18
  AWS[:ec2].describe_regions('us-east-1').body
11
19
  end
12
20
 
@@ -1,5 +1,21 @@
1
1
  Shindo.tests('AWS::EC2 | security group requests', ['aws']) do
2
2
 
3
+ @security_groups_format = {
4
+ 'requestId' => String,
5
+ 'securityGroupInfo' => [{
6
+ 'groupDescription' => String,
7
+ 'groupName' => String,
8
+ 'ipPermissions' => [{
9
+ 'fromPort' => Integer,
10
+ 'groups' => [{ 'groupName' => String, 'userId' => String }],
11
+ 'ipProtocol' => String,
12
+ 'ipRanges' => [],
13
+ 'toPort' => Integer,
14
+ }],
15
+ 'ownerId' => String
16
+ }]
17
+ }
18
+
3
19
  @owner_id = AWS[:ec2].describe_security_groups('default').body['securityGroupInfo'].first['ownerId']
4
20
 
5
21
  tests('success') do
@@ -25,11 +41,11 @@ Shindo.tests('AWS::EC2 | security group requests', ['aws']) do
25
41
  }).body
26
42
  end
27
43
 
28
- tests("#describe_security_groups").formats(AWS::EC2::Formats::SECURITY_GROUPS) do
44
+ tests("#describe_security_groups").formats(@security_groups_format) do
29
45
  AWS[:ec2].describe_security_groups.body
30
46
  end
31
47
 
32
- tests("#describe_security_groups('fog_security_group')").formats(AWS::EC2::Formats::SECURITY_GROUPS) do
48
+ tests("#describe_security_groups('fog_security_group')").formats(@security_groups_format) do
33
49
  AWS[:ec2].describe_security_groups('fog_security_group').body
34
50
  end
35
51
 
@@ -1,23 +1,40 @@
1
1
  Shindo.tests('AWS::EC2 | snapshot requests', ['aws']) do
2
2
 
3
+ @snapshot_format = {
4
+ 'description' => NilClass,
5
+ 'ownerId' => String,
6
+ 'progress' => String,
7
+ 'snapshotId' => String,
8
+ 'startTime' => Time,
9
+ 'status' => String,
10
+ 'volumeId' => String,
11
+ 'volumeSize' => Integer
12
+ }
13
+
14
+ @snapshots_format = {
15
+ 'requestId' => String,
16
+ 'snapshotSet' => [@snapshot_format]
17
+ }
18
+
3
19
  @volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1)
4
20
 
5
21
  tests('success') do
6
22
 
7
23
  @snapshot_id = nil
8
24
 
9
- tests("#create_snapshot(#{@volume.identity})").formats(AWS::EC2::Formats::SNAPSHOT.merge('progress' => NilClass, 'requestId' => String)) do
25
+ tests("#create_snapshot(#{@volume.identity})").formats(@snapshot_format.merge('progress' => NilClass, 'requestId' => String)) do
10
26
  data = AWS[:ec2].create_snapshot(@volume.identity).body
11
27
  @snapshot_id = data['snapshotId']
12
28
  data
13
29
  end
14
30
 
15
- tests("#describe_snapshots").formats(AWS::EC2::Formats::SNAPSHOTS) do
16
- AWS[:ec2].snapshots.get(@snapshot_id).wait_for { ready? }
31
+ AWS[:ec2].snapshots.get(@snapshot_id).wait_for { ready? }
32
+
33
+ tests("#describe_snapshots").formats(@snapshots_format) do
17
34
  AWS[:ec2].describe_snapshots.body
18
35
  end
19
36
 
20
- tests("#describe_snapshots('#{@snapshot_id}')").formats(AWS::EC2::Formats::SNAPSHOTS) do
37
+ tests("#describe_snapshots('#{@snapshot_id}')").formats(@snapshots_format) do
21
38
  AWS[:ec2].describe_snapshots(@snapshot_id).body
22
39
  end
23
40
 
@@ -1,5 +1,37 @@
1
1
  Shindo.tests('AWS::EC2 | volume requests', ['aws']) do
2
2
 
3
+ @volume_format = {
4
+ 'availabilityZone' => String,
5
+ 'createTime' => Time,
6
+ 'requestId' => String,
7
+ 'size' => Integer,
8
+ 'snapshotId' => NilClass,
9
+ 'status' => String,
10
+ 'volumeId' => String
11
+ }
12
+
13
+ @volume_attachment_format = {
14
+ 'attachTime' => Time,
15
+ 'device' => String,
16
+ 'instanceId' => String,
17
+ 'requestId' => String,
18
+ 'status' => String,
19
+ 'volumeId' => String
20
+ }
21
+
22
+ @volumes_format = {
23
+ 'volumeSet' => [{
24
+ 'availabilityZone' => String,
25
+ 'attachmentSet' => [],
26
+ 'createTime' => Time,
27
+ 'size' => Integer,
28
+ 'snapshotId' => NilClass,
29
+ 'status' => String,
30
+ 'volumeId' => String
31
+ }],
32
+ 'requestId' => String
33
+ }
34
+
3
35
  @server = AWS[:ec2].servers.create(:image_id => GENTOO_AMI)
4
36
  @server.wait_for { ready? }
5
37
 
@@ -7,32 +39,35 @@ Shindo.tests('AWS::EC2 | volume requests', ['aws']) do
7
39
 
8
40
  @volume_id = nil
9
41
 
10
- tests('#create_volume').formats(AWS::EC2::Formats::VOLUME) do
42
+ tests('#create_volume').formats(@volume_format) do
11
43
  data = AWS[:ec2].create_volume(@server.availability_zone, 1).body
12
44
  @volume_id = data['volumeId']
13
45
  data
14
46
  end
15
47
 
16
- tests('#describe_volumes').formats(AWS::EC2::Formats::VOLUMES) do
48
+ tests('#describe_volumes').formats(@volumes_format) do
17
49
  AWS[:ec2].describe_volumes.body
18
50
  end
19
51
 
20
- tests("#describe_volumes(#{@volume_id})").formats(AWS::EC2::Formats::VOLUMES) do
52
+ tests("#describe_volumes(#{@volume_id})").formats(@volumes_format) do
21
53
  AWS[:ec2].describe_volumes.body
22
54
  end
23
55
 
24
- tests("#attach_volume(#{@server.identity}, #{@volume_id}, '/dev/sdh')").formats(AWS::EC2::Formats::VOLUME_ATTACHMENT) do
25
- AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
56
+ AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
57
+
58
+ tests("#attach_volume(#{@server.identity}, #{@volume_id}, '/dev/sdh')").formats(@volume_attachment_format) do
26
59
  AWS[:ec2].attach_volume(@server.identity, @volume_id, '/dev/sdh').body
27
60
  end
28
61
 
29
- tests("#detach_volume('#{@volume_id}')").formats(AWS::EC2::Formats::VOLUME_ATTACHMENT) do
30
- AWS[:ec2].volumes.get(@volume_id).wait_for { state == 'in-use' }
62
+ AWS[:ec2].volumes.get(@volume_id).wait_for { state == 'in-use' }
63
+
64
+ tests("#detach_volume('#{@volume_id}')").formats(@volume_attachment_format) do
31
65
  AWS[:ec2].detach_volume(@volume_id).body
32
66
  end
33
67
 
68
+ AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
69
+
34
70
  tests("#delete_volume('#{@volume_id}')").formats(AWS::EC2::Formats::BASIC) do
35
- AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
36
71
  AWS[:ec2].delete_volume(@volume_id).body
37
72
  end
38
73
 
@@ -1,48 +1,19 @@
1
1
  Shindo.tests('test_helper', 'meta') do
2
2
 
3
- tests('#has_error') do
4
-
5
- tests('returns true') do
6
-
7
- test('when expected error is raised') do
8
- has_error(StandardError) { raise StandardError.new }
9
- end
10
-
11
- end
12
-
13
- tests('returns false') do
14
-
15
- test('when no error is raised') do
16
- !has_error(StandardError) {}
17
- end
18
-
19
- test('when a different error is raised') do
20
- begin
21
- !has_error(StandardError) { raise Interrupt.new }
22
- false
23
- rescue Interrupt
24
- true
25
- end
26
- end
27
-
28
- end
29
-
30
- end
31
-
32
- tests('#has_format') do
3
+ tests('#formats_kernel') do
33
4
 
34
5
  tests('returns true') do
35
6
 
36
7
  test('when format of value matches') do
37
- has_format({:a => :b}, {:a => Symbol})
8
+ formats_kernel({:a => :b}, {:a => Symbol})
38
9
  end
39
10
 
40
11
  test('when format of nested array elements matches') do
41
- has_format({:a => [:b, :c]}, {:a => [Symbol]})
12
+ formats_kernel({:a => [:b, :c]}, {:a => [Symbol]})
42
13
  end
43
14
 
44
15
  test('when format of nested hash matches') do
45
- has_format({:a => {:b => :c}}, {:a => {:b => Symbol}})
16
+ formats_kernel({:a => {:b => :c}}, {:a => {:b => Symbol}})
46
17
  end
47
18
 
48
19
  end
@@ -50,15 +21,15 @@ Shindo.tests('test_helper', 'meta') do
50
21
  tests('returns false') do
51
22
 
52
23
  test('when format of value does not match') do
53
- !has_format({:a => :b}, {:a => String})
24
+ !formats_kernel({:a => :b}, {:a => String})
54
25
  end
55
26
 
56
27
  test('when not all keys are checked') do
57
- !has_format({:a => :b}, {})
28
+ !formats_kernel({:a => :b}, {})
58
29
  end
59
30
 
60
31
  test('when some keys do not appear') do
61
- !has_format({}, {:a => String})
32
+ !formats_kernel({}, {:a => String})
62
33
  end
63
34
 
64
35
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 3
9
- version: 0.1.3
8
+ - 4
9
+ version: 0.1.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - geemus (Wesley Beary)