internuity-awsum 0.2

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.
@@ -0,0 +1,114 @@
1
+ require File.expand_path('../../helper', File.dirname(__FILE__))
2
+
3
+ class ImagesTest < Test::Unit::TestCase
4
+ context "ImageParser:" do
5
+ context "Parsing the result of a call to DescribeImages" do
6
+ setup {
7
+ ec2 = Awsum::Ec2.new('abc', 'xyz')
8
+ xml = load_fixture('ec2/images')
9
+ parser = Awsum::Ec2::ImageParser.new(ec2)
10
+ @result = parser.parse(xml)
11
+ }
12
+
13
+ should "return an array of images" do
14
+ assert @result.is_a?(Array)
15
+ assert @result[0].is_a?(Awsum::Ec2::Image)
16
+ end
17
+
18
+ context ", the first image" do
19
+ setup {
20
+ @image = @result[0]
21
+ }
22
+
23
+ should "have the correct id" do
24
+ assert_equal "aki-0d9f7b64", @image.id
25
+ end
26
+
27
+ should "have the correct location" do
28
+ assert_equal "oracle_linux_kernels/2.6.18-53.1.13.9.1.el5xen/vmlinuz-2.6.18-53.1.13.9.1.el5xen.manifest.xml", @image.location
29
+ end
30
+
31
+ should "have the correct state" do
32
+ assert_equal "available", @image.state
33
+ end
34
+
35
+ should "have the correct owner" do
36
+ assert_equal "725966715235", @image.owner
37
+ end
38
+
39
+ should "not be marked as public" do
40
+ assert @image.public?
41
+ end
42
+
43
+ should "have the correct architecture" do
44
+ assert_equal "x86_64", @image.architecture
45
+ end
46
+
47
+ should "have the correct type" do
48
+ assert_equal "kernel", @image.type
49
+ end
50
+ end
51
+
52
+ context ", the second image" do
53
+ setup {
54
+ @image = @result[1]
55
+ }
56
+
57
+ should "have the correct id" do
58
+ assert_equal "aki-25de3b4c", @image.id
59
+ end
60
+
61
+ should "have an array of product codes" do
62
+ assert @image.product_codes.is_a?(Array)
63
+ end
64
+
65
+ should "have the corrects product codes" do
66
+ assert_equal "54DBF944", @image.product_codes[0]
67
+ end
68
+ end
69
+
70
+ context ", the third image" do
71
+ setup {
72
+ @image = @result[2]
73
+ }
74
+
75
+ should "have the correct id" do
76
+ assert_equal "ami-005db969", @image.id
77
+ end
78
+
79
+ should "have the correct kernelId" do
80
+ assert_equal "aki-b51cf9dc", @image.kernel_id
81
+ end
82
+
83
+ should "have the correct ram disk id" do
84
+ assert_equal "ari-b31cf9da", @image.ramdisk_id
85
+ end
86
+ end
87
+ end
88
+ end
89
+
90
+ context "RegisterImageParser:" do
91
+ context "Parsing the result of a call to RegisterImage" do
92
+ setup {
93
+ ec2 = Awsum::Ec2.new('abc', 'xyz')
94
+ xml = load_fixture('ec2/register_image')
95
+ parser = Awsum::Ec2::RegisterImageParser.new(ec2)
96
+ @result = parser.parse(xml)
97
+ }
98
+
99
+ should "return an image id" do
100
+ assert @result.is_a?(String)
101
+ end
102
+
103
+ context ", the image id" do
104
+ setup {
105
+ @image = @result
106
+ }
107
+
108
+ should "have the correct id" do
109
+ assert_equal "ami-4782652e", @image
110
+ end
111
+ end
112
+ end
113
+ end
114
+ end
@@ -0,0 +1,127 @@
1
+ require File.expand_path('../../helper', File.dirname(__FILE__))
2
+
3
+ class InstancesTest < Test::Unit::TestCase
4
+ context "InstanceParser:" do
5
+ context "Parsing the result of a call to DescribeInstances" do
6
+ setup {
7
+ ec2 = Awsum::Ec2.new('abc', 'xyz')
8
+ xml = load_fixture('ec2/instances')
9
+ parser = Awsum::Ec2::InstanceParser.new(ec2)
10
+ @result = parser.parse(xml)
11
+ }
12
+
13
+ should "return an array of instances" do
14
+ assert @result.is_a?(Array)
15
+ assert_equal Awsum::Ec2::Instance, @result[0].class
16
+ end
17
+
18
+ context ", the first instance" do
19
+ setup {
20
+ @instance = @result[0]
21
+ }
22
+
23
+ should "have the correct id" do
24
+ assert_equal "i-3f1cc856", @instance.id
25
+ end
26
+
27
+ should "have the correct private DNS name" do
28
+ assert_equal "ip-10-255-255-255.ec2.internal", @instance.private_dns_name
29
+ end
30
+
31
+ should "have the correct public DNS name" do
32
+ assert_equal "ec2-75-255-255-255.compute-1.amazonaws.com", @instance.dns_name
33
+ end
34
+
35
+ should "have the correct key name" do
36
+ assert_equal "gsg-keypair", @instance.key_name
37
+ end
38
+
39
+ should "have the correct launch index" do
40
+ assert_equal 0, @instance.launch_index
41
+ end
42
+
43
+ should "have the correct type" do
44
+ assert_equal 'm1.small', @instance.type
45
+ end
46
+
47
+ should "have the correct availability zone" do
48
+ assert_equal 'us-east-1b', @instance.availability_zone
49
+ end
50
+
51
+ should "have the correct launch time" do
52
+ assert_equal '2008-06-18T12:51:52.000Z', @instance.launch_time.strftime('%Y-%m-%dT%H:%M:%S.000Z')
53
+ end
54
+
55
+ should "have the correct state" do
56
+ assert_equal({:code => 0, :name => 'pending'}, @instance.state)
57
+ end
58
+ end
59
+
60
+ context ", the second instance" do
61
+ setup {
62
+ @instance = @result[1]
63
+ }
64
+
65
+ should "have the correct state" do
66
+ assert_equal({:code => 16, :name => 'running'}, @instance.state)
67
+ end
68
+ end
69
+ end
70
+
71
+ context "Parsing the result of a call to RunInstances" do
72
+ setup {
73
+ ec2 = Awsum::Ec2.new('abc', 'xyz')
74
+ xml = load_fixture('ec2/run_instances')
75
+ parser = Awsum::Ec2::InstanceParser.new(ec2)
76
+ @result = parser.parse(xml)
77
+ }
78
+
79
+ should "return an array of instances" do
80
+ assert @result.is_a?(Array)
81
+ assert_equal Awsum::Ec2::Instance, @result[0].class
82
+ end
83
+
84
+ context ", the first instance" do
85
+ setup {
86
+ @instance = @result[0]
87
+ }
88
+
89
+ should "have the correct id" do
90
+ assert_equal "i-f92fa890", @instance.id
91
+ end
92
+
93
+ should "have the correct private DNS name" do
94
+ assert_equal nil, @instance.private_dns_name
95
+ end
96
+
97
+ should "have the correct public DNS name" do
98
+ assert_equal nil, @instance.dns_name
99
+ end
100
+
101
+ should "have the correct key name" do
102
+ assert_equal nil, @instance.key_name
103
+ end
104
+
105
+ should "have the correct launch index" do
106
+ assert_equal 0, @instance.launch_index
107
+ end
108
+
109
+ should "have the correct type" do
110
+ assert_equal 'm1.small', @instance.type
111
+ end
112
+
113
+ should "have the correct availability zone" do
114
+ assert_equal 'us-east-1b', @instance.availability_zone
115
+ end
116
+
117
+ should "have the correct launch time" do
118
+ assert_equal '2009-01-11T13:09:01.000Z', @instance.launch_time.strftime('%Y-%m-%dT%H:%M:%S.000Z')
119
+ end
120
+
121
+ should "have the correct state" do
122
+ assert_equal({:code => 0, :name => 'pending'}, @instance.state)
123
+ end
124
+ end
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,45 @@
1
+ require File.expand_path('../../helper', File.dirname(__FILE__))
2
+
3
+ class SnapshotsTest < Test::Unit::TestCase
4
+ context "SnapshotParser:" do
5
+ context "Parsing the result of a call to DescribeSnapshots" do
6
+ setup {
7
+ ec2 = Awsum::Ec2.new('abc', 'xyz')
8
+ xml = load_fixture('ec2/snapshots')
9
+ parser = Awsum::Ec2::SnapshotParser.new(ec2)
10
+ @result = parser.parse(xml)
11
+ }
12
+
13
+ should "return an array of snapshots" do
14
+ assert @result.is_a?(Array)
15
+ assert @result[0].is_a?(Awsum::Ec2::Snapshot)
16
+ end
17
+
18
+ context ", the first snapshot" do
19
+ setup {
20
+ @snapshot = @result[0]
21
+ }
22
+
23
+ should "have the correct id" do
24
+ assert_equal "snap-747c911d", @snapshot.id
25
+ end
26
+
27
+ should "have the correct volume id" do
28
+ assert "vol-79d13510", @snapshot.volume_id
29
+ end
30
+
31
+ should "have the correct status" do
32
+ assert_equal "completed", @snapshot.status
33
+ end
34
+
35
+ should "have the correct start time" do
36
+ assert_equal '2009-01-15T03:59:26.000Z', @snapshot.start_time.strftime('%Y-%m-%dT%H:%M:%S.000Z')
37
+ end
38
+
39
+ should "have the correct progress" do
40
+ assert_equal '100%', @snapshot.progress
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,65 @@
1
+ require File.expand_path('../../helper', File.dirname(__FILE__))
2
+
3
+ class VolumesTest < Test::Unit::TestCase
4
+ context "VolumeParser:" do
5
+ context "Parsing the result of a call to DescribeVolumes" do
6
+ setup {
7
+ ec2 = Awsum::Ec2.new('abc', 'xyz')
8
+ xml = load_fixture('ec2/volumes')
9
+ parser = Awsum::Ec2::VolumeParser.new(ec2)
10
+ @result = parser.parse(xml)
11
+ }
12
+
13
+ should "return an array of volumes" do
14
+ assert @result.is_a?(Array)
15
+ assert @result[0].is_a?(Awsum::Ec2::Volume)
16
+ end
17
+
18
+ context ", the first volume" do
19
+ setup {
20
+ @volume = @result[0]
21
+ }
22
+
23
+ should "have the correct id" do
24
+ assert_equal "vol-44d6322d", @volume.id
25
+ end
26
+
27
+ should "have the correct size" do
28
+ assert_equal 10, @volume.size
29
+ end
30
+
31
+ should "have the correct snapshot id" do
32
+ assert_nil @volume.snapshot_id
33
+ end
34
+
35
+ should "have the correct availability zone" do
36
+ assert_equal "us-east-1b", @volume.availability_zone
37
+ end
38
+
39
+ should "have the correct status" do
40
+ assert_equal "in-use", @volume.status
41
+ end
42
+
43
+ should "have the correct create time" do
44
+ assert_equal '2009-01-14T03:57:08.000Z', @volume.create_time.strftime('%Y-%m-%dT%H:%M:%S.000Z')
45
+ end
46
+
47
+ should "have the correct instance id" do
48
+ assert_equal 'i-3f1cc856', @volume.instance_id
49
+ end
50
+
51
+ should "have the correct device" do
52
+ assert_equal '/dev/sdb', @volume.device
53
+ end
54
+
55
+ should "have the correct attachment_status" do
56
+ assert_equal 'attached', @volume.attachment_status
57
+ end
58
+
59
+ should "have the correct attach time" do
60
+ assert_equal '2009-01-14T04:34:35.000Z', @volume.attach_time.strftime('%Y-%m-%dT%H:%M:%S.000Z')
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,7 @@
1
+ require File.expand_path('../helper', File.dirname(__FILE__))
2
+
3
+ class AwsumTest < Test::Unit::TestCase
4
+ should "pass" do
5
+ assert true
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: internuity-awsum
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.2"
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Timberlake
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-01-15 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: thoughtbot-shoulda
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: mocha
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ description:
36
+ email: andrew@andrewtimberlake.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - README.rdoc
43
+ files:
44
+ - README.rdoc
45
+ - LICENSE
46
+ - Rakefile
47
+ - lib/requestable.rb
48
+ - lib/support.rb
49
+ - lib/ec2
50
+ - lib/ec2/instance.rb
51
+ - lib/ec2/image.rb
52
+ - lib/ec2/volume.rb
53
+ - lib/ec2/snapshot.rb
54
+ - lib/ec2/ec2.rb
55
+ - lib/awsum.rb
56
+ - lib/parser.rb
57
+ - test/units
58
+ - test/units/ec2
59
+ - test/units/ec2/test_image.rb
60
+ - test/units/ec2/test_ec2.rb
61
+ - test/units/ec2/test_snapshot.rb
62
+ - test/units/ec2/test_instance.rb
63
+ - test/units/ec2/test_volume.rb
64
+ - test/units/test_awsum.rb
65
+ - test/helper.rb
66
+ - test/dump.rb
67
+ - test/fixtures
68
+ - test/fixtures/ec2
69
+ - test/fixtures/ec2/instances.xml
70
+ - test/fixtures/ec2/instance.xml
71
+ - test/fixtures/ec2/attach_volume.xml
72
+ - test/fixtures/ec2/create_snapshot.xml
73
+ - test/fixtures/ec2/available_volume.xml
74
+ - test/fixtures/ec2/detach_volume.xml
75
+ - test/fixtures/ec2/create_volume.xml
76
+ - test/fixtures/ec2/delete_snapshot.xml
77
+ - test/fixtures/ec2/volumes.xml
78
+ - test/fixtures/ec2/images.xml
79
+ - test/fixtures/ec2/delete_volume.xml
80
+ - test/fixtures/ec2/image.xml
81
+ - test/fixtures/ec2/run_instances.xml
82
+ - test/fixtures/ec2/terminate_instances.xml
83
+ - test/fixtures/ec2/snapshots.xml
84
+ - test/fixtures/errors
85
+ - test/fixtures/errors/invalid_parameter_value.xml
86
+ has_rdoc: true
87
+ homepage: http://www.internuity.net/projects/awsum
88
+ post_install_message:
89
+ rdoc_options:
90
+ - --line-numbers
91
+ - --inline-source
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: "0"
99
+ version:
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: "0"
105
+ version:
106
+ requirements: []
107
+
108
+ rubyforge_project: awsum
109
+ rubygems_version: 1.2.0
110
+ signing_key:
111
+ specification_version: 2
112
+ summary: Ruby library for working with Amazon Web Services
113
+ test_files:
114
+ - test/units/ec2/test_image.rb
115
+ - test/units/ec2/test_ec2.rb
116
+ - test/units/ec2/test_snapshot.rb
117
+ - test/units/ec2/test_instance.rb
118
+ - test/units/ec2/test_volume.rb
119
+ - test/units/test_awsum.rb
120
+ - test/fixtures/ec2/instances.xml
121
+ - test/fixtures/ec2/instance.xml
122
+ - test/fixtures/ec2/attach_volume.xml
123
+ - test/fixtures/ec2/create_snapshot.xml
124
+ - test/fixtures/ec2/available_volume.xml
125
+ - test/fixtures/ec2/detach_volume.xml
126
+ - test/fixtures/ec2/create_volume.xml
127
+ - test/fixtures/ec2/delete_snapshot.xml
128
+ - test/fixtures/ec2/volumes.xml
129
+ - test/fixtures/ec2/images.xml
130
+ - test/fixtures/ec2/delete_volume.xml
131
+ - test/fixtures/ec2/image.xml
132
+ - test/fixtures/ec2/run_instances.xml
133
+ - test/fixtures/ec2/terminate_instances.xml
134
+ - test/fixtures/ec2/snapshots.xml
135
+ - test/fixtures/errors/invalid_parameter_value.xml