deltacloud-core 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/bin/deltacloudd +11 -5
- data/config.ru +3 -3
- data/deltacloud-core.gemspec +24 -18
- data/lib/cimi/collections/address_templates.rb +3 -3
- data/lib/cimi/collections/addresses.rb +6 -5
- data/lib/cimi/collections/entity_metadata.rb +0 -2
- data/lib/cimi/collections/machine_admins.rb +5 -5
- data/lib/cimi/collections/machine_configurations.rb +2 -2
- data/lib/cimi/collections/machine_images.rb +3 -3
- data/lib/cimi/collections/machines.rb +32 -10
- data/lib/cimi/collections/network_configurations.rb +4 -3
- data/lib/cimi/collections/network_templates.rb +4 -3
- data/lib/cimi/collections/networks.rb +8 -8
- data/lib/cimi/collections/routing_group_templates.rb +4 -3
- data/lib/cimi/collections/routing_groups.rb +4 -3
- data/lib/cimi/collections/volume_configurations.rb +3 -3
- data/lib/cimi/collections/volume_images.rb +3 -3
- data/lib/cimi/collections/volumes.rb +4 -3
- data/lib/cimi/collections/vsp_configurations.rb +4 -3
- data/lib/cimi/collections/vsp_templates.rb +4 -3
- data/lib/cimi/collections/vsps.rb +8 -7
- data/lib/cimi/helpers.rb +1 -1
- data/lib/cimi/helpers/cimi_helper.rb +11 -1
- data/lib/cimi/models.rb +4 -0
- data/lib/cimi/models/base.rb +11 -1
- data/lib/cimi/models/cloud_entry_point.rb +7 -14
- data/lib/cimi/models/disk.rb +40 -0
- data/lib/cimi/models/disk_collection.rb +38 -0
- data/lib/cimi/models/machine.rb +9 -43
- data/lib/cimi/models/machine_collection.rb +7 -4
- data/lib/cimi/models/machine_configuration.rb +8 -15
- data/lib/cimi/models/machine_configuration_collection.rb +6 -4
- data/lib/cimi/models/machine_image_collection.rb +6 -4
- data/lib/cimi/models/machine_template_collection.rb +6 -4
- data/lib/cimi/models/machine_volume.rb +42 -0
- data/lib/cimi/models/machine_volume_collection.rb +34 -0
- data/lib/cimi/models/network.rb +5 -9
- data/lib/cimi/models/network_collection.rb +6 -5
- data/lib/cimi/models/schema.rb +20 -0
- data/lib/cimi/models/volume_collection.rb +6 -4
- data/lib/cimi/models/volume_configuration_collection.rb +6 -4
- data/lib/cimi/models/volume_image_collection.rb +6 -4
- data/lib/cimi/models/volume_template_collection.rb +6 -4
- data/lib/deltacloud/api.rb +3 -3
- data/lib/deltacloud/collections/addresses.rb +1 -1
- data/lib/deltacloud/collections/firewalls.rb +4 -2
- data/lib/deltacloud/collections/keys.rb +1 -1
- data/lib/deltacloud/collections/load_balancers.rb +1 -1
- data/lib/deltacloud/collections/storage_volumes.rb +4 -4
- data/lib/deltacloud/drivers/base_driver.rb +12 -20
- data/lib/deltacloud/drivers/ec2/aws_vpc_monkey_patch.rb +294 -0
- data/lib/deltacloud/drivers/ec2/ec2_driver.rb +38 -6
- data/lib/deltacloud/drivers/fgcp/fgcp_client.rb +4 -0
- data/lib/deltacloud/drivers/fgcp/fgcp_driver.rb +40 -4
- data/lib/deltacloud/drivers/gogrid/gogrid_client.rb +8 -7
- data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +422 -416
- data/lib/deltacloud/drivers/google/google_driver.rb +2 -1
- data/lib/deltacloud/drivers/openstack/openstack_driver.rb +30 -16
- data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +1 -0
- data/lib/deltacloud/drivers/vsphere/vsphere_driver.rb +3 -9
- data/lib/deltacloud/helpers/deltacloud_helper.rb +0 -2
- data/lib/deltacloud/models/firewall_rule.rb +2 -0
- data/lib/deltacloud/models/hardware_profile.rb +61 -59
- data/{tests/deprecated/core_ext/string.rb → lib/deltacloud/version.rb} +3 -15
- data/lib/deltacloud_rack.rb +1 -0
- data/lib/ec2/server.rb +5 -3
- data/lib/sinatra/rack_accept.rb +53 -53
- data/lib/sinatra/rack_etag.rb +1 -1
- data/tests/cimi/collections/cloud_entry_point_test.rb +11 -2
- data/tests/deltacloud/common.rb +1 -1
- data/tests/deltacloud/rack_test.rb +3 -3
- data/tests/drivers/base/base_driver_test.rb +6 -2
- data/tests/drivers/base/common.rb +1 -0
- data/tests/drivers/base/library_test.rb +6 -2
- data/tests/drivers/ec2/common.rb +34 -15
- data/tests/drivers/ec2/images_test.rb +2 -3
- data/tests/drivers/ec2/instance_test.rb +12 -2
- data/tests/drivers/ec2/keys_test.rb +2 -2
- data/tests/drivers/ec2/realms_test.rb +7 -3
- data/tests/drivers/ec2/storage_snapshots_test.rb +2 -3
- data/tests/drivers/gogrid/common.rb +24 -0
- data/tests/drivers/gogrid/hardware_profiles_test.rb +51 -0
- data/tests/drivers/gogrid/images_test.rb +57 -0
- data/tests/drivers/gogrid/instances_test.rb +92 -0
- data/tests/drivers/gogrid/realms_test.rb +45 -0
- data/tests/drivers/google/buckets_test.rb +105 -0
- data/tests/drivers/google/common.rb +20 -0
- data/tests/drivers/mock/common.rb +1 -0
- data/tests/drivers/mock/images_test.rb +3 -2
- data/tests/drivers/mock/instances_test.rb +3 -2
- data/tests/drivers/mock/keys_test.rb +3 -2
- data/tests/drivers/mock/realms_test.rb +3 -2
- data/tests/drivers/mock/storage_snapshots_test.rb +3 -2
- data/tests/drivers/mock/storage_volumes_test.rb +3 -2
- data/tests/drivers/models/address_test.rb +3 -3
- data/tests/drivers/models/base_test.rb +4 -2
- data/tests/drivers/models/blob_test.rb +3 -3
- data/tests/drivers/models/common.rb +3 -0
- data/tests/drivers/models/hardware_profile_test.rb +5 -4
- data/tests/drivers/models/instance_address_test.rb +3 -3
- data/tests/drivers/models/instance_profile_test.rb +3 -3
- data/tests/drivers/models/instance_test.rb +3 -3
- data/tests/drivers/models/keys_test.rb +3 -3
- data/tests/drivers/models/metrics_test.rb +3 -3
- data/tests/drivers/openstack/common.rb +26 -0
- data/tests/drivers/openstack/hardware_profiles_test.rb +46 -0
- data/tests/drivers/openstack/images_test.rb +50 -0
- data/tests/drivers/openstack/instances_test.rb +66 -0
- data/tests/drivers/openstack/keys_test.rb +61 -0
- data/tests/drivers/openstack/realms_test.rb +46 -0
- data/tests/drivers/rhevm/common.rb +2 -0
- data/tests/drivers/rhevm/images_test.rb +3 -4
- data/tests/drivers/rhevm/instance_test.rb +2 -2
- data/tests/drivers/rhevm/provider_test.rb +2 -2
- data/tests/drivers/rhevm/realms_test.rb +2 -3
- data/tests/ec2/common.rb +5 -4
- data/tests/ec2/server_test.rb +3 -2
- data/tests/helpers/rack/common.rb +3 -0
- data/tests/helpers/rack/rack_accept_test.rb +65 -0
- data/tests/helpers/rack/rack_date_test.rb +27 -0
- data/tests/helpers/rack/rack_driver_select_test.rb +53 -0
- data/tests/helpers/rack/rack_etag_test.rb +29 -0
- data/tests/helpers/rack/rack_matrix_params_test.rb +72 -0
- data/tests/test_helper.rb +44 -36
- data/views/hardware_profiles/index.html.haml +1 -1
- data/views/hardware_profiles/show.html.haml +2 -2
- data/views/hardware_profiles/show.xml.haml +2 -1
- data/views/images/show.html.haml +6 -5
- metadata +74 -117
- data/tests/deprecated/api/common.rb +0 -1
- data/tests/deprecated/api/driver_test.rb +0 -79
- data/tests/deprecated/api/library_test.rb +0 -6
- data/tests/deprecated/cimi/features/step_definitions/common_steps.rb +0 -59
- data/tests/deprecated/cimi/features/step_definitions/machine_images_steps.rb +0 -0
- data/tests/deprecated/cimi/features/step_definitions/machines_steps.rb +0 -100
- data/tests/deprecated/cimi/features/step_definitions/volumes_steps.rb +0 -115
- data/tests/deprecated/cimi/features/support/env.rb +0 -75
- data/tests/deprecated/common.rb +0 -279
- data/tests/deprecated/drivers/ec2/api_test.rb +0 -19
- data/tests/deprecated/drivers/ec2/common.rb +0 -23
- data/tests/deprecated/drivers/ec2/drivers_test.rb +0 -120
- data/tests/deprecated/drivers/ec2/hardware_profiles_test.rb +0 -224
- data/tests/deprecated/drivers/ec2/images_test.rb +0 -230
- data/tests/deprecated/drivers/ec2/instances_test.rb +0 -356
- data/tests/deprecated/drivers/ec2/keys_test.rb +0 -181
- data/tests/deprecated/drivers/ec2/realms_test.rb +0 -146
- data/tests/deprecated/drivers/fgcp/api_test.rb +0 -47
- data/tests/deprecated/drivers/fgcp/hardware_profiles_test.rb +0 -54
- data/tests/deprecated/drivers/fgcp/realms_test.rb +0 -42
- data/tests/deprecated/drivers/fgcp/setup.rb +0 -13
- data/tests/deprecated/drivers/google/api_test.rb +0 -19
- data/tests/deprecated/drivers/google/buckets_test.rb +0 -100
- data/tests/deprecated/drivers/google/common.rb +0 -54
- data/tests/deprecated/drivers/mock/api_test.rb +0 -10
- data/tests/deprecated/drivers/mock/buckets_test.rb +0 -195
- data/tests/deprecated/drivers/mock/common.rb +0 -7
- data/tests/deprecated/drivers/mock/drivers_test.rb +0 -123
- data/tests/deprecated/drivers/mock/hardware_profiles_test.rb +0 -224
- data/tests/deprecated/drivers/mock/images_test.rb +0 -197
- data/tests/deprecated/drivers/mock/instances_test.rb +0 -343
- data/tests/deprecated/drivers/mock/keys_test.rb +0 -161
- data/tests/deprecated/drivers/mock/realms_test.rb +0 -132
- data/tests/deprecated/drivers/mock/storage_snapshots_test.rb +0 -114
- data/tests/deprecated/drivers/mock/storage_volumes_test.rb +0 -122
- data/tests/deprecated/drivers/openstack/api_test.rb +0 -46
- data/tests/deprecated/drivers/openstack/common.rb +0 -21
- data/tests/deprecated/drivers/openstack/hardware_profiles_test.rb +0 -64
- data/tests/deprecated/drivers/openstack/images_test.rb +0 -46
- data/tests/deprecated/drivers/openstack/instances_test.rb +0 -208
- data/tests/deprecated/drivers/openstack/realms_test.rb +0 -40
- data/tests/deprecated/drivers/rackspace/api_test.rb +0 -46
- data/tests/deprecated/drivers/rackspace/buckets_test.rb +0 -150
- data/tests/deprecated/drivers/rackspace/common.rb +0 -16
- data/tests/deprecated/drivers/rackspace/hardware_profiles_test.rb +0 -58
- data/tests/deprecated/drivers/rackspace/images_test.rb +0 -45
- data/tests/deprecated/drivers/rackspace/instances_test.rb +0 -166
- data/tests/deprecated/drivers/rackspace/realms_test.rb +0 -41
- data/tests/deprecated/drivers/rhevm/api_test.rb +0 -45
- data/tests/deprecated/drivers/rhevm/common.rb +0 -21
- data/tests/deprecated/drivers/rhevm/hardware_profiles_test.rb +0 -58
- data/tests/deprecated/drivers/rhevm/images_test.rb +0 -48
- data/tests/deprecated/drivers/rhevm/instances_test.rb +0 -182
- data/tests/deprecated/drivers/rhevm/realms_test.rb +0 -40
- data/tests/deprecated/minitest_common.rb +0 -58
- data/tests/deprecated/minitest_common_api_test.rb +0 -115
- data/tests/deprecated/rabbit_test.rb +0 -52
@@ -1,161 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
|
2
|
-
require 'tests/drivers/mock/common'
|
3
|
-
|
4
|
-
describe 'Deltacloud API Keys' do
|
5
|
-
include Deltacloud::Test
|
6
|
-
|
7
|
-
it 'must advertise have the keys collection in API entrypoint' do
|
8
|
-
get root_url
|
9
|
-
(xml_response/'api/link[@rel=keys]').wont_be_empty
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'must require authentication to access the "key" collection' do
|
13
|
-
get collection_url(:keys)
|
14
|
-
last_response.status.must_equal 401
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'should respond with HTTP_OK when accessing the :keys collection with authentication' do
|
18
|
-
authenticate
|
19
|
-
get collection_url(:keys)
|
20
|
-
last_response.status.must_equal 200
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should support the JSON media type' do
|
24
|
-
authenticate
|
25
|
-
header 'Accept', 'application/json'
|
26
|
-
get collection_url(:keys)
|
27
|
-
last_response.status.must_equal 200
|
28
|
-
last_response.headers['Content-Type'].must_equal 'application/json'
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'must include the ETag in HTTP headers' do
|
32
|
-
authenticate
|
33
|
-
get collection_url(:keys)
|
34
|
-
last_response.headers['ETag'].wont_be_nil
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'must have the "keys" element on top level' do
|
38
|
-
authenticate
|
39
|
-
get collection_url(:keys)
|
40
|
-
xml_response.root.name.must_equal 'keys'
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'must have some "key" elements inside "keys"' do
|
44
|
-
authenticate
|
45
|
-
get collection_url(:keys)
|
46
|
-
(xml_response/'keys/key').wont_be_empty
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'must tell the kind of "key" elements inside "keys"' do
|
50
|
-
authenticate
|
51
|
-
get collection_url(:keys)
|
52
|
-
(xml_response/'keys/key').each do |k|
|
53
|
-
k[:type].must_match /(key|password)/
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'must provide the :id attribute for each key in collection' do
|
58
|
-
authenticate
|
59
|
-
get collection_url(:keys)
|
60
|
-
(xml_response/'keys/key').each do |r|
|
61
|
-
r[:id].wont_be_nil
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'must include the :href attribute for each "key" element in collection' do
|
66
|
-
authenticate
|
67
|
-
get collection_url(:keys)
|
68
|
-
(xml_response/'keys/key').each do |r|
|
69
|
-
r[:href].wont_be_nil
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'must use the absolute URL in each :href attribute' do
|
74
|
-
authenticate
|
75
|
-
get collection_url(:keys)
|
76
|
-
(xml_response/'keys/key').each do |r|
|
77
|
-
r[:href].must_match /^http/
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'must have the URL ending with the :id of the key' do
|
82
|
-
authenticate
|
83
|
-
get collection_url(:keys)
|
84
|
-
(xml_response/'keys/key').each do |r|
|
85
|
-
r[:href].must_match /#{r[:id]}$/
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'must return the list of valid parameters for the :index action' do
|
90
|
-
authenticate
|
91
|
-
options collection_url(:keys) + '/index'
|
92
|
-
last_response.headers['Allow'].wont_be_nil
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'must have the "name" element defined for each key in collection' do
|
96
|
-
authenticate
|
97
|
-
get collection_url(:keys)
|
98
|
-
(xml_response/'keys/key').each do |r|
|
99
|
-
(r/'name').wont_be_empty
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
|
104
|
-
it 'must return the full "key" when following the URL in key element' do
|
105
|
-
authenticate
|
106
|
-
get collection_url(:keys)
|
107
|
-
(xml_response/'keys/key').each do |r|
|
108
|
-
get collection_url(:keys) + '/' + r[:id]
|
109
|
-
last_response.status.must_equal 200
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
it 'must have the "name" element for the key and it should match with the one in collection' do
|
114
|
-
authenticate
|
115
|
-
get collection_url(:keys)
|
116
|
-
(xml_response/'keys/key').each do |r|
|
117
|
-
get collection_url(:keys) + '/' + r[:id]
|
118
|
-
(xml_response/'name').wont_be_empty
|
119
|
-
(xml_response/'name').first.text.must_equal((r/'name').first.text)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'must have the "name" element for the key and it should match with the one in collection' do
|
124
|
-
authenticate
|
125
|
-
get collection_url(:keys)
|
126
|
-
(xml_response/'keys/key').each do |r|
|
127
|
-
get collection_url(:keys) + '/' + r[:id]
|
128
|
-
(xml_response/'state').wont_be_empty
|
129
|
-
(xml_response/'state').first.text.must_equal((r/'state').first.text)
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
it 'should advertise the list of actions that can be executed for each key' do
|
134
|
-
authenticate
|
135
|
-
get collection_url(:keys)
|
136
|
-
(xml_response/'keys/key').each do |r|
|
137
|
-
get collection_url(:keys) + '/' + r[:id]
|
138
|
-
(xml_response/'actions/link').wont_be_empty
|
139
|
-
(xml_response/'actions/link').each do |l|
|
140
|
-
l[:href].wont_be_nil
|
141
|
-
l[:href].must_match /^http/
|
142
|
-
l[:method].wont_be_nil
|
143
|
-
l[:rel].wont_be_nil
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
it 'should allow to create a new key and then remove it' do
|
149
|
-
authenticate
|
150
|
-
key_name = Time.now.to_i.to_s
|
151
|
-
post collection_url(:keys), {
|
152
|
-
:name => 'test_key_'+key_name
|
153
|
-
}
|
154
|
-
last_response.status.must_equal 201 # HTTP_CREATED
|
155
|
-
get collection_url(:keys) + '/' + 'test_key_'+key_name
|
156
|
-
last_response.status.must_equal 200 # HTTP_OK
|
157
|
-
delete collection_url(:keys) + '/' + 'test_key_'+key_name
|
158
|
-
last_response.status.must_equal 204 # HTTP_NO_CONTENT
|
159
|
-
end
|
160
|
-
|
161
|
-
end
|
@@ -1,132 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
|
2
|
-
require 'tests/drivers/mock/common'
|
3
|
-
|
4
|
-
describe 'Deltacloud API Realms' do
|
5
|
-
include Deltacloud::Test
|
6
|
-
|
7
|
-
it 'must advertise have the realms collection in API entrypoint' do
|
8
|
-
get root_url
|
9
|
-
(xml_response/'api/link[@rel=realms]').wont_be_empty
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'must require authentication to access the "realm" collection' do
|
13
|
-
get collection_url(:realms)
|
14
|
-
last_response.status.must_equal 401
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'should respond with HTTP_OK when accessing the :realms collection with authentication' do
|
18
|
-
authenticate
|
19
|
-
get collection_url(:realms)
|
20
|
-
last_response.status.must_equal 200
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should support the JSON media type' do
|
24
|
-
authenticate
|
25
|
-
header 'Accept', 'application/json'
|
26
|
-
get collection_url(:realms)
|
27
|
-
last_response.status.must_equal 200
|
28
|
-
last_response.headers['Content-Type'].must_equal 'application/json'
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'must include the ETag in HTTP headers' do
|
32
|
-
authenticate
|
33
|
-
get collection_url(:realms)
|
34
|
-
last_response.headers['ETag'].wont_be_nil
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'must have the "realms" element on top level' do
|
38
|
-
authenticate
|
39
|
-
get collection_url(:realms)
|
40
|
-
xml_response.root.name.must_equal 'realms'
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'must have some "realm" elements inside "realms"' do
|
44
|
-
authenticate
|
45
|
-
get collection_url(:realms)
|
46
|
-
(xml_response/'realms/realm').wont_be_empty
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'must provide the :id attribute for each realm in collection' do
|
50
|
-
authenticate
|
51
|
-
get collection_url(:realms)
|
52
|
-
(xml_response/'realms/realm').each do |r|
|
53
|
-
r[:id].wont_be_nil
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'must include the :href attribute for each "realm" element in collection' do
|
58
|
-
authenticate
|
59
|
-
get collection_url(:realms)
|
60
|
-
(xml_response/'realms/realm').each do |r|
|
61
|
-
r[:href].wont_be_nil
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'must use the absolute URL in each :href attribute' do
|
66
|
-
authenticate
|
67
|
-
get collection_url(:realms)
|
68
|
-
(xml_response/'realms/realm').each do |r|
|
69
|
-
r[:href].must_match /^http/
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'must have the URL ending with the :id of the realm' do
|
74
|
-
authenticate
|
75
|
-
get collection_url(:realms)
|
76
|
-
(xml_response/'realms/realm').each do |r|
|
77
|
-
r[:href].must_match /#{r[:id]}$/
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'must return the list of valid parameters for the :index action' do
|
82
|
-
authenticate
|
83
|
-
options collection_url(:realms) + '/index'
|
84
|
-
last_response.headers['Allow'].wont_be_nil
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'must have the "name" element defined for each realm in collection' do
|
88
|
-
authenticate
|
89
|
-
get collection_url(:realms)
|
90
|
-
(xml_response/'realms/realm').each do |r|
|
91
|
-
(r/'name').wont_be_empty
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'must have the "state" element defined for each realm in collection' do
|
96
|
-
authenticate
|
97
|
-
get collection_url(:realms)
|
98
|
-
(xml_response/'realms/realm').each do |r|
|
99
|
-
(r/'state').wont_be_empty
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
it 'must return the full "realm" when following the URL in realm element' do
|
104
|
-
authenticate
|
105
|
-
get collection_url(:realms)
|
106
|
-
(xml_response/'realms/realm').each do |r|
|
107
|
-
get collection_url(:realms) + '/' + r[:id]
|
108
|
-
last_response.status.must_equal 200
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
it 'must have the "name" element for the realm and it should match with the one in collection' do
|
113
|
-
authenticate
|
114
|
-
get collection_url(:realms)
|
115
|
-
(xml_response/'realms/realm').each do |r|
|
116
|
-
get collection_url(:realms) + '/' + r[:id]
|
117
|
-
(xml_response/'name').wont_be_empty
|
118
|
-
(xml_response/'name').first.text.must_equal((r/'name').first.text)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
it 'must have the "state" element for the realm and it should match with the one in collection' do
|
123
|
-
authenticate
|
124
|
-
get collection_url(:realms)
|
125
|
-
(xml_response/'realms/realm').each do |r|
|
126
|
-
get collection_url(:realms) + '/' + r[:id]
|
127
|
-
(xml_response/'state').wont_be_empty
|
128
|
-
(xml_response/'state').first.text.must_equal((r/'state').first.text)
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
end
|
@@ -1,114 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
|
2
|
-
require 'tests/drivers/mock/common'
|
3
|
-
|
4
|
-
describe 'Deltacloud API storage_snapshots' do
|
5
|
-
include Deltacloud::Test
|
6
|
-
|
7
|
-
it 'must advertise have the storage_snapshots collection in API entrypoint' do
|
8
|
-
get root_url
|
9
|
-
(xml_response/'api/link[@rel=storage_snapshots]').wont_be_empty
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'must require authentication to access the "storage_snapshot" collection' do
|
13
|
-
get collection_url(:storage_snapshots)
|
14
|
-
last_response.status.must_equal 401
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'should respond with HTTP_OK when accessing the :storage_snapshots collection with authentication' do
|
18
|
-
authenticate
|
19
|
-
get collection_url(:storage_snapshots)
|
20
|
-
last_response.status.must_equal 200
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should support the JSON media type' do
|
24
|
-
authenticate
|
25
|
-
header 'Accept', 'application/json'
|
26
|
-
get collection_url(:storage_snapshots)
|
27
|
-
last_response.status.must_equal 200
|
28
|
-
last_response.headers['Content-Type'].must_equal 'application/json'
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'must include the ETag in HTTP headers' do
|
32
|
-
authenticate
|
33
|
-
get collection_url(:storage_snapshots)
|
34
|
-
last_response.headers['ETag'].wont_be_nil
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'must have the "storage_snapshots" element on top level' do
|
38
|
-
authenticate
|
39
|
-
get collection_url(:storage_snapshots)
|
40
|
-
xml_response.root.name.must_equal 'storage_snapshots'
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'must have some "storage_snapshot" elements inside "storage_snapshots"' do
|
44
|
-
authenticate
|
45
|
-
get collection_url(:storage_snapshots)
|
46
|
-
(xml_response/'storage_snapshots/storage_snapshot').wont_be_empty
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'must provide the :id attribute for each storage_snapshot in collection' do
|
50
|
-
authenticate
|
51
|
-
get collection_url(:storage_snapshots)
|
52
|
-
(xml_response/'storage_snapshots/storage_snapshot').each do |r|
|
53
|
-
r[:id].wont_be_nil
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'must include the :href attribute for each "storage_snapshot" element in collection' do
|
58
|
-
authenticate
|
59
|
-
get collection_url(:storage_snapshots)
|
60
|
-
(xml_response/'storage_snapshots/storage_snapshot').each do |r|
|
61
|
-
r[:href].wont_be_nil
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'must use the absolute URL in each :href attribute' do
|
66
|
-
authenticate
|
67
|
-
get collection_url(:storage_snapshots)
|
68
|
-
(xml_response/'storage_snapshots/storage_snapshot').each do |r|
|
69
|
-
r[:href].must_match /^http/
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'must have the URL ending with the :id of the storage_snapshot' do
|
74
|
-
authenticate
|
75
|
-
get collection_url(:storage_snapshots)
|
76
|
-
(xml_response/'storage_snapshots/storage_snapshot').each do |r|
|
77
|
-
r[:href].must_match /#{r[:id]}$/
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'must return the list of valid parameters for the :index action' do
|
82
|
-
authenticate
|
83
|
-
options collection_url(:storage_snapshots) + '/index'
|
84
|
-
last_response.headers['Allow'].wont_be_nil
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'must have the "name" element defined for each storage_snapshot in collection' do
|
88
|
-
authenticate
|
89
|
-
get collection_url(:storage_snapshots)
|
90
|
-
(xml_response/'storage_snapshots/storage_snapshot').each do |r|
|
91
|
-
(r/'name').wont_be_empty
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'must return the full "storage_snapshot" when following the URL in storage_snapshot element' do
|
96
|
-
authenticate
|
97
|
-
get collection_url(:storage_snapshots)
|
98
|
-
(xml_response/'storage_snapshots/storage_snapshot').each do |r|
|
99
|
-
get collection_url(:storage_snapshots) + '/' + r[:id]
|
100
|
-
last_response.status.must_equal 200
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
it 'must have the "name" element for the storage_snapshot and it should match with the one in collection' do
|
105
|
-
authenticate
|
106
|
-
get collection_url(:storage_snapshots)
|
107
|
-
(xml_response/'storage_snapshots/storage_snapshot').each do |r|
|
108
|
-
get collection_url(:storage_snapshots) + '/' + r[:id]
|
109
|
-
(xml_response/'name').wont_be_empty
|
110
|
-
(xml_response/'name').first.text.must_equal((r/'name').first.text)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
end
|
@@ -1,122 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
|
2
|
-
require 'tests/drivers/mock/common'
|
3
|
-
|
4
|
-
describe 'Deltacloud API storage_volumes' do
|
5
|
-
include Deltacloud::Test
|
6
|
-
|
7
|
-
it 'must advertise have the storage_volumes collection in API entrypoint' do
|
8
|
-
get root_url
|
9
|
-
(xml_response/'api/link[@rel=storage_volumes]').wont_be_empty
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'must require authentication to access the "storage_volume" collection' do
|
13
|
-
get collection_url(:storage_volumes)
|
14
|
-
last_response.status.must_equal 401
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'should respond with HTTP_OK when accessing the :storage_volumes collection with authentication' do
|
18
|
-
authenticate
|
19
|
-
get collection_url(:storage_volumes)
|
20
|
-
last_response.status.must_equal 200
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should support the JSON media type' do
|
24
|
-
authenticate
|
25
|
-
header 'Accept', 'application/json'
|
26
|
-
get collection_url(:storage_volumes)
|
27
|
-
last_response.status.must_equal 200
|
28
|
-
last_response.headers['Content-Type'].must_equal 'application/json'
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'must include the ETag in HTTP headers' do
|
32
|
-
authenticate
|
33
|
-
get collection_url(:storage_volumes)
|
34
|
-
last_response.headers['ETag'].wont_be_nil
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'must have the "storage_volumes" element on top level' do
|
38
|
-
authenticate
|
39
|
-
get collection_url(:storage_volumes)
|
40
|
-
xml_response.root.name.must_equal 'storage_volumes'
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'must have some "storage_volume" elements inside "storage_volumes"' do
|
44
|
-
authenticate
|
45
|
-
get collection_url(:storage_volumes)
|
46
|
-
(xml_response/'storage_volumes/storage_volume').wont_be_empty
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'must provide the :id attribute for each storage_volume in collection' do
|
50
|
-
authenticate
|
51
|
-
get collection_url(:storage_volumes)
|
52
|
-
(xml_response/'storage_volumes/storage_volume').each do |r|
|
53
|
-
r[:id].wont_be_nil
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'must include the :href attribute for each "storage_volume" element in collection' do
|
58
|
-
authenticate
|
59
|
-
get collection_url(:storage_volumes)
|
60
|
-
(xml_response/'storage_volumes/storage_volume').each do |r|
|
61
|
-
r[:href].wont_be_nil
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'must use the absolute URL in each :href attribute' do
|
66
|
-
authenticate
|
67
|
-
get collection_url(:storage_volumes)
|
68
|
-
(xml_response/'storage_volumes/storage_volume').each do |r|
|
69
|
-
r[:href].must_match /^http/
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'must have the URL ending with the :id of the storage_volume' do
|
74
|
-
authenticate
|
75
|
-
get collection_url(:storage_volumes)
|
76
|
-
(xml_response/'storage_volumes/storage_volume').each do |r|
|
77
|
-
r[:href].must_match /#{r[:id]}$/
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'must return the list of valid parameters for the :index action' do
|
82
|
-
authenticate
|
83
|
-
options collection_url(:storage_volumes) + '/index'
|
84
|
-
last_response.headers['Allow'].wont_be_nil
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'must have the "name" element defined for each storage_volume in collection' do
|
88
|
-
authenticate
|
89
|
-
get collection_url(:storage_volumes)
|
90
|
-
(xml_response/'storage_volumes/storage_volume').each do |r|
|
91
|
-
(r/'name').wont_be_empty
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'must have the "state" element defined for each storage_volume in collection' do
|
96
|
-
authenticate
|
97
|
-
get collection_url(:storage_volumes)
|
98
|
-
(xml_response/'storage_volumes/storage_volume').each do |r|
|
99
|
-
(r/'state').wont_be_empty
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
it 'must return the full "storage_volume" when following the URL in storage_volume element' do
|
104
|
-
authenticate
|
105
|
-
get collection_url(:storage_volumes)
|
106
|
-
(xml_response/'storage_volumes/storage_volume').each do |r|
|
107
|
-
get collection_url(:storage_volumes) + '/' + r[:id]
|
108
|
-
last_response.status.must_equal 200
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
it 'must have the "name" element for the storage_volume and it should match with the one in collection' do
|
113
|
-
authenticate
|
114
|
-
get collection_url(:storage_volumes)
|
115
|
-
(xml_response/'storage_volumes/storage_volume').each do |r|
|
116
|
-
get collection_url(:storage_volumes) + '/' + r[:id]
|
117
|
-
(xml_response/'name').wont_be_empty
|
118
|
-
(xml_response/'name').first.text.must_equal((r/'name').first.text)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
end
|