azure 0.6.4 → 0.7.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env_sample +11 -0
- data/.gitignore +4 -1
- data/.travis.yml +3 -1
- data/ChangeLog.txt +17 -1
- data/LICENSE.txt +202 -0
- data/README.md +58 -20
- data/Rakefile +27 -35
- data/azure.gemspec +17 -13
- data/bin/pfxer +35 -0
- data/lib/azure.rb +8 -0
- data/lib/azure/base_management/base_management_service.rb +24 -26
- data/lib/azure/base_management/management_http_request.rb +17 -14
- data/lib/azure/base_management/serialization.rb +1 -0
- data/lib/azure/blob/auth/shared_access_signature.rb +141 -0
- data/lib/azure/blob/blob_service.rb +221 -217
- data/lib/azure/cloud_service_management/cloud_service_management_service.rb +27 -30
- data/lib/azure/cloud_service_management/serialization.rb +1 -0
- data/lib/azure/core.rb +17 -15
- data/lib/azure/core/configuration.rb +7 -0
- data/lib/azure/core/http/http_error.rb +1 -1
- data/lib/azure/core/http/http_request.rb +4 -1
- data/lib/azure/core/utility.rb +16 -1
- data/lib/azure/queue/queue_service.rb +13 -13
- data/lib/azure/service/cors.rb +11 -0
- data/lib/azure/service/cors_rule.rb +15 -0
- data/lib/azure/service/serialization.rb +69 -10
- data/lib/azure/service/storage_service.rb +10 -6
- data/lib/azure/service/storage_service_properties.rb +8 -3
- data/lib/azure/service_bus/brokered_message.rb +1 -1
- data/lib/azure/service_bus/relay.rb +88 -0
- data/lib/azure/service_bus/serialization.rb +1 -0
- data/lib/azure/service_bus/service_bus_service.rb +70 -4
- data/lib/azure/sql_database_management/serialization.rb +1 -0
- data/lib/azure/sql_database_management/sql_database_management_service.rb +22 -22
- data/lib/azure/storage_management/serialization.rb +34 -14
- data/lib/azure/storage_management/storage_account.rb +9 -1
- data/lib/azure/storage_management/storage_management_service.rb +74 -32
- data/lib/azure/table/batch.rb +6 -6
- data/lib/azure/table/table_service.rb +13 -13
- data/lib/azure/version.rb +3 -3
- data/lib/azure/virtual_machine_image_management/serialization.rb +19 -0
- data/lib/azure/virtual_machine_image_management/virtual_machine_image.rb +1 -1
- data/lib/azure/virtual_machine_image_management/virtual_machine_image_management_service.rb +30 -7
- data/lib/azure/virtual_machine_management/serialization.rb +32 -12
- data/lib/azure/virtual_machine_management/virtual_machine.rb +1 -0
- data/lib/azure/virtual_machine_management/virtual_machine_management_service.rb +92 -81
- data/lib/azure/virtual_network_management/serialization.rb +12 -5
- data/lib/azure/virtual_network_management/virtual_network.rb +1 -0
- data/lib/azure/virtual_network_management/virtual_network_management_service.rb +11 -11
- data/test/fixtures/get_storage_account_properties.xml +6 -4
- data/test/fixtures/{list_images.xml → list_os_images.xml} +1 -1
- data/test/fixtures/list_storage_accounts.xml +2 -0
- data/test/fixtures/list_vm_images.xml +21 -0
- data/test/fixtures/metrics.xml +2 -2
- data/test/fixtures/sb_default_create_relay_response.xml +15 -0
- data/test/fixtures/storage_service_keys.xml +8 -0
- data/test/fixtures/storage_service_properties.xml +35 -3
- data/test/fixtures/updated_storage_accounts.xml +2 -0
- data/test/fixtures/virtual_machine.xml +3 -1
- data/test/integration/affinity_group/Affinity_test.rb +1 -1
- data/test/integration/affinity_group/Create_Affinity_test.rb +8 -7
- data/test/integration/affinity_group/Delete_Affinity_test.rb +3 -3
- data/test/integration/affinity_group/List_Affinity_test.rb +1 -1
- data/test/integration/affinity_group/Update_Affinity_test.rb +9 -8
- data/test/integration/cloud_service/Cloud_Create_test.rb +3 -2
- data/test/integration/cloud_service/Cloud_Delete_test.rb +5 -4
- data/test/integration/database/create_sql_server_firewall_test.rb +1 -1
- data/test/integration/database/create_sql_server_test.rb +1 -1
- data/test/integration/database/delete_sql_server_firewall_test.rb +1 -1
- data/test/integration/database/delete_sql_server_test.rb +1 -1
- data/test/integration/database/list_sql_server_firewall_test.rb +1 -1
- data/test/integration/database/list_sql_servers_test.rb +1 -1
- data/test/integration/database/reset_password_sql_server_test.rb +1 -1
- data/test/integration/service_bus/queues_test.rb +22 -22
- data/test/integration/service_bus/relay_test.rb +132 -0
- data/test/integration/storage_management/storage_management_test.rb +58 -33
- data/test/integration/test_helper.rb +11 -15
- data/test/integration/vm/VM_Create_test.rb +17 -18
- data/test/integration/vm/VM_Delete_test.rb +2 -4
- data/test/integration/vm/VM_Operations_test.rb +1 -2
- data/test/integration/vnet/Virtual_Network_Create_test.rb +9 -15
- data/test/integration/vnet/Virtual_Network_list_test.rb +4 -9
- data/test/support/name_generator.rb +8 -0
- data/test/support/virtual_network_helper.rb +2 -2
- data/test/test_helper.rb +13 -24
- data/test/unit/affinity_group/affinity_group_test.rb +10 -13
- data/test/unit/affinity_group/serialization_test.rb +7 -8
- data/test/unit/base_management/location_test.rb +1 -2
- data/test/unit/blob/auth/shared_access_signature_test.rb +71 -0
- data/test/unit/blob/blob_service_test.rb +393 -371
- data/test/unit/cloud_service_management/cloud_service_management_service_test.rb +16 -16
- data/test/unit/core/auth/shared_key_lite_test.rb +4 -4
- data/test/unit/core/auth/shared_key_test.rb +2 -2
- data/test/unit/core/http/http_error_test.rb +10 -5
- data/test/unit/core/http/http_request_test.rb +72 -25
- data/test/unit/database/serialization_test.rb +7 -7
- data/test/unit/database/sql_database_server_service_test.rb +43 -47
- data/test/unit/service/serialization_test.rb +40 -9
- data/test/unit/service/storage_service_test.rb +13 -11
- data/test/unit/storage_management/serialization_test.rb +26 -14
- data/test/unit/storage_management/storage_management_service_test.rb +48 -62
- data/test/unit/virtual_machine_image_management/serialization_test.rb +20 -5
- data/test/unit/virtual_machine_image_management/virtual_machine_image_management_service_test.rb +78 -29
- data/test/unit/virtual_machine_management/serialization_test.rb +112 -43
- data/test/unit/virtual_machine_management/virtual_machine_management_service_test.rb +123 -100
- data/test/unit/vnet/serialization_test.rb +7 -7
- data/test/unit/vnet/virtual_network_management_service_test.rb +1 -1
- metadata +70 -16
- data/test/fixtures/certificate.pem +0 -21
@@ -17,7 +17,7 @@ require 'test_helper'
|
|
17
17
|
describe Azure::BaseManagement::Serialization do
|
18
18
|
|
19
19
|
subject { Azure::BaseManagement::Serialization }
|
20
|
-
let(:
|
20
|
+
let(:geo_location) { 'West Us' }
|
21
21
|
|
22
22
|
describe '#affinity_group_to_xml' do
|
23
23
|
let(:affinity_group_name) { 'AG1' }
|
@@ -25,26 +25,26 @@ describe Azure::BaseManagement::Serialization do
|
|
25
25
|
|
26
26
|
it 'serializes the argument to xml' do
|
27
27
|
result = subject.affinity_group_to_xml(affinity_group_name,
|
28
|
-
|
28
|
+
geo_location,
|
29
29
|
label)
|
30
30
|
doc = Nokogiri::XML result
|
31
31
|
doc.css('Name').text.must_equal affinity_group_name
|
32
32
|
doc.css('Label').text.must_equal Base64.encode64(label).strip
|
33
|
-
doc.css('Location').text.must_equal
|
33
|
+
doc.css('Location').text.must_equal geo_location
|
34
34
|
result.must_be_kind_of String
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'serializes the argument to xml when optional description is given' do
|
38
|
-
options = {
|
38
|
+
options = {description: 'Affinity Group Description'}
|
39
39
|
result = subject.affinity_group_to_xml(affinity_group_name,
|
40
|
-
|
40
|
+
geo_location,
|
41
41
|
label,
|
42
42
|
options)
|
43
43
|
doc = Nokogiri::XML result
|
44
44
|
doc.css('Name').text.must_equal affinity_group_name
|
45
45
|
doc.css('Label').text.must_equal Base64.encode64(label).strip
|
46
46
|
doc.css('Description').text.must_equal options[:description]
|
47
|
-
doc.css('Location').text.must_equal
|
47
|
+
doc.css('Location').text.must_equal geo_location
|
48
48
|
result.must_be_kind_of String
|
49
49
|
end
|
50
50
|
end
|
@@ -81,8 +81,7 @@ describe Azure::BaseManagement::Serialization do
|
|
81
81
|
affinity_group.storage_services.size.must_equal 1
|
82
82
|
affinity_group.capability.must_equal %w[PersistentVMRole HighMemory]
|
83
83
|
affinity_group.name.must_equal affinity_group_xml.css('Name').text
|
84
|
-
affinity_group.description.must_equal affinity_group_xml.css(
|
85
|
-
'Description').text
|
84
|
+
affinity_group.description.must_equal affinity_group_xml.css('Description').text
|
86
85
|
end
|
87
86
|
end
|
88
87
|
end
|
@@ -23,7 +23,6 @@ describe Azure::BaseManagement::Location do
|
|
23
23
|
describe "#list_locations" do
|
24
24
|
let(:request_path) { '/locations' }
|
25
25
|
let(:locations_xml) { Fixtures['list_locations'] }
|
26
|
-
let(:method) { :get }
|
27
26
|
let(:mock_request){ mock() }
|
28
27
|
let(:response) {
|
29
28
|
response = mock()
|
@@ -33,7 +32,7 @@ describe Azure::BaseManagement::Location do
|
|
33
32
|
let(:response_body) { Nokogiri::XML response.body }
|
34
33
|
|
35
34
|
before {
|
36
|
-
ManagementHttpRequest.stubs(:new).with(
|
35
|
+
Azure::BaseManagement::ManagementHttpRequest.stubs(:new).with(:get, request_path, nil).returns(mock_request)
|
37
36
|
mock_request.expects(:call).returns(response_body)
|
38
37
|
}
|
39
38
|
|
@@ -0,0 +1,71 @@
|
|
1
|
+
#-------------------------------------------------------------------------
|
2
|
+
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
#--------------------------------------------------------------------------
|
15
|
+
require "test_helper"
|
16
|
+
require "azure/blob/auth/shared_access_signature"
|
17
|
+
require "base64"
|
18
|
+
require "uri"
|
19
|
+
|
20
|
+
describe Azure::Blob::Auth::SharedAccessSignature do
|
21
|
+
let(:path) { 'example/path' }
|
22
|
+
let(:options) {
|
23
|
+
{
|
24
|
+
permissions: 'rwd',
|
25
|
+
expiry: '2013-12-11',
|
26
|
+
resource: 'b',
|
27
|
+
version: '2013-08-15',
|
28
|
+
content_disposition: 'inline, filename=nyan.cat'
|
29
|
+
}
|
30
|
+
}
|
31
|
+
let(:access_account_name) { 'account-name' }
|
32
|
+
let(:access_key_base64) { Base64.strict_encode64('access-key') }
|
33
|
+
|
34
|
+
subject { Azure::Blob::Auth::SharedAccessSignature.new(path, options, access_account_name, access_key_base64) }
|
35
|
+
|
36
|
+
it "decodes the base64 encoded access_key" do
|
37
|
+
subject.access_key.must_equal 'access-key'
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "#signable_string" do
|
41
|
+
|
42
|
+
it "constructs a string in the required format" do
|
43
|
+
subject.signable_string.must_equal(
|
44
|
+
"rwd\n\n2013-12-11\n/account-name/example/path\n\n2013-08-15\n\ninline, filename=nyan.cat\n\n\n"
|
45
|
+
)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "#canonicalized_resource" do
|
50
|
+
it "prefixes and concatenates account name and resource path with forward slashes" do
|
51
|
+
subject.canonicalized_resource.must_equal '/account-name/example/path'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "#signed_uri" do
|
56
|
+
let(:uri) { URI(subject.signed_uri) }
|
57
|
+
let(:query_hash) { Hash[URI.decode_www_form(uri.query)] }
|
58
|
+
|
59
|
+
it "maps options to the abbreviated API versions" do
|
60
|
+
query_hash['sp'].must_equal 'rwd'
|
61
|
+
query_hash['se'].must_equal '2013-12-11'
|
62
|
+
query_hash['sr'].must_equal 'b'
|
63
|
+
query_hash['rscd'].must_equal 'inline, filename=nyan.cat'
|
64
|
+
end
|
65
|
+
|
66
|
+
it "includes the signature" do
|
67
|
+
query_hash['sig'].must_equal subject.sign(subject.signable_string)
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
@@ -20,30 +20,30 @@ require 'azure/blob/blob'
|
|
20
20
|
require 'azure/service/signed_identifier'
|
21
21
|
|
22
22
|
describe Azure::Blob::BlobService do
|
23
|
-
|
23
|
+
|
24
24
|
subject { Azure::Blob::BlobService.new }
|
25
25
|
let(:serialization) { Azure::Blob::Serialization }
|
26
26
|
let(:uri) { URI.parse "http://foo.com" }
|
27
27
|
let(:query) { {} }
|
28
|
-
let(:request_headers) { {} }
|
28
|
+
let(:request_headers) { {'x-ms-version' => '2013-08-15'} }
|
29
29
|
let(:request_body) { "request-body" }
|
30
30
|
|
31
31
|
let(:response_headers) { {} }
|
32
32
|
let(:response_body) { mock() }
|
33
33
|
let(:response) { mock() }
|
34
34
|
|
35
|
-
before {
|
35
|
+
before {
|
36
36
|
response.stubs(:body).returns(response_body)
|
37
37
|
response.stubs(:headers).returns(response_headers)
|
38
38
|
}
|
39
39
|
|
40
40
|
describe "#list_containers" do
|
41
|
-
let(:
|
41
|
+
let(:verb) { :get }
|
42
42
|
let(:container_enumeration_result) { Azure::Service::EnumerationResults.new }
|
43
43
|
|
44
|
-
before {
|
44
|
+
before {
|
45
45
|
subject.stubs(:containers_uri).with({}).returns(uri)
|
46
|
-
subject.stubs(:call).with(
|
46
|
+
subject.stubs(:call).with(verb, uri).returns(response)
|
47
47
|
serialization.stubs(:container_enumeration_results_from_xml).with(response_body).returns(container_enumeration_result)
|
48
48
|
}
|
49
49
|
|
@@ -53,7 +53,7 @@ describe Azure::Blob::BlobService do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it "calls StorageService#call with the prepared request" do
|
56
|
-
subject.expects(:call).with(
|
56
|
+
subject.expects(:call).with(verb, uri).returns(response)
|
57
57
|
subject.list_containers
|
58
58
|
end
|
59
59
|
|
@@ -74,48 +74,48 @@ describe Azure::Blob::BlobService do
|
|
74
74
|
}
|
75
75
|
|
76
76
|
it "modifies the URI query parameters when provided a :prefix value" do
|
77
|
-
query = {
|
77
|
+
query = {"prefix" => "pre"}
|
78
78
|
subject.expects(:containers_uri).with(query).returns(uri)
|
79
79
|
|
80
|
-
options = {
|
80
|
+
options = {:prefix => "pre"}
|
81
81
|
subject.list_containers options
|
82
82
|
end
|
83
|
-
|
83
|
+
|
84
84
|
it "modifies the URI query parameters when provided a :marker value" do
|
85
|
-
query = {
|
85
|
+
query = {"marker" => "mark"}
|
86
86
|
subject.expects(:containers_uri).with(query).returns(uri)
|
87
87
|
|
88
|
-
options = {
|
88
|
+
options = {:marker => "mark"}
|
89
89
|
subject.list_containers options
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
it "modifies the URI query parameters when provided a :max_results value" do
|
93
|
-
query = {
|
93
|
+
query = {"maxresults" => "5"}
|
94
94
|
subject.expects(:containers_uri).with(query).returns(uri)
|
95
95
|
|
96
|
-
options = {
|
96
|
+
options = {:max_results => 5}
|
97
97
|
subject.list_containers options
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
it "modifies the URI query parameters when provided a :metadata value" do
|
101
|
-
query = {
|
101
|
+
query = {"include" => "metadata"}
|
102
102
|
subject.expects(:containers_uri).with(query).returns(uri)
|
103
103
|
|
104
|
-
options = {
|
104
|
+
options = {:metadata => true}
|
105
105
|
subject.list_containers options
|
106
106
|
end
|
107
107
|
|
108
108
|
it "modifies the URI query parameters when provided a :timeout value" do
|
109
|
-
query = {
|
109
|
+
query = {"timeout" => "37"}
|
110
110
|
subject.expects(:containers_uri).with(query).returns(uri)
|
111
111
|
|
112
|
-
options = {
|
112
|
+
options = {:timeout => 37}
|
113
113
|
subject.list_containers options
|
114
114
|
end
|
115
115
|
it "does not modify the URI query parameters when provided an unknown value" do
|
116
116
|
subject.expects(:containers_uri).with({}).returns(uri)
|
117
117
|
|
118
|
-
options = {
|
118
|
+
options = {:unknown_key => "some_value"}
|
119
119
|
subject.list_containers options
|
120
120
|
end
|
121
121
|
end
|
@@ -127,10 +127,10 @@ describe Azure::Blob::BlobService do
|
|
127
127
|
|
128
128
|
describe "#create_container" do
|
129
129
|
|
130
|
-
let(:
|
131
|
-
before {
|
130
|
+
let(:verb) { :put }
|
131
|
+
before {
|
132
132
|
subject.stubs(:container_uri).with(container_name, {}).returns(uri)
|
133
|
-
subject.stubs(:call).with(
|
133
|
+
subject.stubs(:call).with(verb, uri, nil, request_headers).returns(response)
|
134
134
|
serialization.stubs(:container_from_headers).with(response_headers).returns(container)
|
135
135
|
}
|
136
136
|
|
@@ -140,7 +140,7 @@ describe Azure::Blob::BlobService do
|
|
140
140
|
end
|
141
141
|
|
142
142
|
it "calls StorageService#call with the prepared request" do
|
143
|
-
subject.expects(:call).with(
|
143
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
144
144
|
subject.create_container container_name
|
145
145
|
end
|
146
146
|
|
@@ -158,21 +158,21 @@ describe Azure::Blob::BlobService do
|
|
158
158
|
|
159
159
|
describe "when optional metadata parameter is used" do
|
160
160
|
let(:container_metadata) {
|
161
|
-
{
|
162
|
-
|
163
|
-
|
164
|
-
|
161
|
+
{
|
162
|
+
'MetadataKey' => 'MetaDataValue',
|
163
|
+
'MetadataKey1' => 'MetaDataValue1'}
|
164
|
+
}
|
165
165
|
|
166
|
-
before
|
166
|
+
before do
|
167
167
|
request_headers = {
|
168
|
-
|
169
|
-
|
168
|
+
'x-ms-meta-MetadataKey' => 'MetaDataValue',
|
169
|
+
'x-ms-meta-MetadataKey1' => 'MetaDataValue1',
|
170
|
+
'x-ms-version' => '2013-08-15'
|
170
171
|
}
|
171
|
-
|
172
172
|
subject.stubs(:container_uri).with(container_name, {}).returns(uri)
|
173
173
|
serialization.stubs(:container_from_headers).with(response_headers).returns(container)
|
174
|
-
subject.stubs(:call).with(
|
175
|
-
|
174
|
+
subject.stubs(:call).with(verb, uri, nil, request_headers).returns(response)
|
175
|
+
end
|
176
176
|
|
177
177
|
it "adds metadata to the request headers" do
|
178
178
|
subject.create_container container_name, container_metadata
|
@@ -182,35 +182,35 @@ describe Azure::Blob::BlobService do
|
|
182
182
|
describe "when optional public_access_level parameter is used" do
|
183
183
|
let(:public_access_level) { "public-access-level-value" }
|
184
184
|
|
185
|
-
before {
|
186
|
-
request_headers = {
|
185
|
+
before {
|
186
|
+
request_headers = {"x-ms-blob-public-access" => public_access_level, 'x-ms-version' => '2013-08-15'}
|
187
187
|
|
188
188
|
subject.stubs(:container_uri).with(container_name, {}).returns(uri)
|
189
189
|
serialization.stubs(:container_from_headers).with(response_headers).returns(container)
|
190
|
-
subject.stubs(:call).with(
|
190
|
+
subject.stubs(:call).with(verb, uri, nil, request_headers).returns(response)
|
191
191
|
}
|
192
192
|
|
193
193
|
it "adds public_access_level to the request headers" do
|
194
|
-
subject.create_container container_name, {
|
194
|
+
subject.create_container container_name, {:public_access_level => public_access_level}
|
195
195
|
end
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
199
|
-
describe "#delete_container" do
|
200
|
-
let(:
|
199
|
+
describe "#delete_container" do
|
200
|
+
let(:verb) { :delete }
|
201
201
|
before {
|
202
202
|
response.stubs(:success?).returns(true)
|
203
203
|
subject.stubs(:container_uri).with(container_name, {}).returns(uri)
|
204
|
-
subject.stubs(:call).with(
|
204
|
+
subject.stubs(:call).with(verb, uri).returns(response)
|
205
205
|
}
|
206
|
-
|
206
|
+
|
207
207
|
it "assembles a URI for the request" do
|
208
208
|
subject.expects(:container_uri).with(container_name, {}).returns(uri)
|
209
209
|
subject.delete_container container_name
|
210
210
|
end
|
211
211
|
|
212
212
|
it "calls StorageService#call with the prepared request" do
|
213
|
-
subject.expects(:call).with(
|
213
|
+
subject.expects(:call).with(verb, uri).returns(response)
|
214
214
|
subject.delete_container container_name
|
215
215
|
end
|
216
216
|
|
@@ -221,14 +221,14 @@ describe Azure::Blob::BlobService do
|
|
221
221
|
end
|
222
222
|
|
223
223
|
describe "#get_container_properties" do
|
224
|
-
let(:
|
224
|
+
let(:verb) { :get }
|
225
225
|
let(:container_properties) { {} }
|
226
226
|
|
227
227
|
before {
|
228
228
|
container.properties = container_properties
|
229
229
|
response_headers = {}
|
230
230
|
subject.stubs(:container_uri).with(container_name, {}).returns(uri)
|
231
|
-
subject.stubs(:call).with(
|
231
|
+
subject.stubs(:call).with(verb, uri).returns(response)
|
232
232
|
serialization.stubs(:container_from_headers).with(response_headers).returns(container)
|
233
233
|
}
|
234
234
|
|
@@ -238,7 +238,7 @@ describe Azure::Blob::BlobService do
|
|
238
238
|
end
|
239
239
|
|
240
240
|
it "calls StorageService#call with the prepared request" do
|
241
|
-
subject.expects(:call).with(
|
241
|
+
subject.expects(:call).with(verb, uri).returns(response)
|
242
242
|
subject.get_container_properties container_name
|
243
243
|
end
|
244
244
|
|
@@ -256,15 +256,15 @@ describe Azure::Blob::BlobService do
|
|
256
256
|
end
|
257
257
|
|
258
258
|
describe "#get_container_metadata" do
|
259
|
-
let(:
|
260
|
-
let(:container_metadata) { {
|
261
|
-
let(:response_headers) { {
|
259
|
+
let(:verb) { :get }
|
260
|
+
let(:container_metadata) { {"MetadataKey" => "MetaDataValue", "MetadataKey1" => "MetaDataValue1"} }
|
261
|
+
let(:response_headers) { {"x-ms-meta-MetadataKey" => "MetaDataValue", "x-ms-meta-MetadataKey1" => "MetaDataValue1"} }
|
262
262
|
|
263
263
|
before {
|
264
|
-
query.update({
|
265
|
-
response.stubs(:headers).returns(response_headers)
|
264
|
+
query.update({"comp" => "metadata"})
|
265
|
+
response.stubs(:headers).returns(response_headers)
|
266
266
|
subject.stubs(:container_uri).with(container_name, query).returns(uri)
|
267
|
-
subject.stubs(:call).with(
|
267
|
+
subject.stubs(:call).with(verb, uri).returns(response)
|
268
268
|
|
269
269
|
container.metadata = container_metadata
|
270
270
|
serialization.stubs(:container_from_headers).with(response_headers).returns(container)
|
@@ -276,7 +276,7 @@ describe Azure::Blob::BlobService do
|
|
276
276
|
end
|
277
277
|
|
278
278
|
it "calls StorageService#call with the prepared request" do
|
279
|
-
subject.expects(:call).with(
|
279
|
+
subject.expects(:call).with(verb, uri).returns(response)
|
280
280
|
subject.get_container_metadata container_name
|
281
281
|
end
|
282
282
|
|
@@ -294,16 +294,16 @@ describe Azure::Blob::BlobService do
|
|
294
294
|
end
|
295
295
|
|
296
296
|
describe "#get_container_acl" do
|
297
|
-
let(:
|
298
|
-
let(:signed_identifier){ Azure::Service::SignedIdentifier.new }
|
299
|
-
let(:signed_identifiers){ [signed_identifier] }
|
297
|
+
let(:verb) { :get }
|
298
|
+
let(:signed_identifier) { Azure::Service::SignedIdentifier.new }
|
299
|
+
let(:signed_identifiers) { [signed_identifier] }
|
300
300
|
|
301
301
|
before {
|
302
|
-
query.update({"comp"=>"acl"})
|
303
|
-
response.stubs(:headers).returns({})
|
302
|
+
query.update({"comp" => "acl"})
|
303
|
+
response.stubs(:headers).returns({})
|
304
304
|
response_body.stubs(:length).returns(37)
|
305
305
|
subject.stubs(:container_uri).with(container_name, query).returns(uri)
|
306
|
-
subject.stubs(:call).with(
|
306
|
+
subject.stubs(:call).with(verb, uri).returns(response)
|
307
307
|
|
308
308
|
serialization.stubs(:container_from_headers).with(response_headers).returns(container)
|
309
309
|
serialization.stubs(:signed_identifiers_from_xml).with(response_body).returns(signed_identifiers)
|
@@ -315,7 +315,7 @@ describe Azure::Blob::BlobService do
|
|
315
315
|
end
|
316
316
|
|
317
317
|
it "calls StorageService#call with the prepared request" do
|
318
|
-
subject.expects(:call).with(
|
318
|
+
subject.expects(:call).with(verb, uri).returns(response)
|
319
319
|
subject.get_container_acl container_name
|
320
320
|
end
|
321
321
|
|
@@ -327,7 +327,7 @@ describe Azure::Blob::BlobService do
|
|
327
327
|
|
328
328
|
it "returns a container and an ACL" do
|
329
329
|
returned_container, returned_acl = subject.get_container_acl container_name
|
330
|
-
|
330
|
+
|
331
331
|
returned_container.must_be_kind_of Azure::Blob::Container
|
332
332
|
returned_container.name.must_equal container_name
|
333
333
|
|
@@ -337,16 +337,16 @@ describe Azure::Blob::BlobService do
|
|
337
337
|
end
|
338
338
|
|
339
339
|
describe "#set_container_acl" do
|
340
|
-
let(:
|
340
|
+
let(:verb) { :put }
|
341
341
|
let(:public_access_level) { "any-public-access-level" }
|
342
342
|
|
343
343
|
before {
|
344
|
-
query.update({"comp"=>"acl"})
|
344
|
+
query.update({"comp" => "acl"})
|
345
345
|
request_headers["x-ms-blob-public-access"] = public_access_level
|
346
346
|
|
347
|
-
response.stubs(:headers).returns({})
|
347
|
+
response.stubs(:headers).returns({})
|
348
348
|
subject.stubs(:container_uri).with(container_name, query).returns(uri)
|
349
|
-
subject.stubs(:call).with(
|
349
|
+
subject.stubs(:call).with(verb, uri, nil, request_headers).returns(response)
|
350
350
|
serialization.stubs(:container_from_headers).with(response_headers).returns(container)
|
351
351
|
}
|
352
352
|
|
@@ -356,7 +356,7 @@ describe Azure::Blob::BlobService do
|
|
356
356
|
end
|
357
357
|
|
358
358
|
it "calls StorageService#call with the prepared request" do
|
359
|
-
subject.expects(:call).with(
|
359
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
360
360
|
subject.set_container_acl container_name, public_access_level
|
361
361
|
end
|
362
362
|
|
@@ -368,40 +368,40 @@ describe Azure::Blob::BlobService do
|
|
368
368
|
|
369
369
|
it "returns a container and an ACL" do
|
370
370
|
returned_container, returned_acl = subject.set_container_acl container_name, public_access_level
|
371
|
-
|
371
|
+
|
372
372
|
returned_container.must_be_kind_of Azure::Blob::Container
|
373
373
|
returned_container.name.must_equal container_name
|
374
374
|
returned_container.public_access_level.must_equal public_access_level
|
375
375
|
|
376
376
|
returned_acl.must_be_kind_of Array
|
377
377
|
end
|
378
|
-
|
378
|
+
|
379
379
|
describe "when the public_access_level parameter is set to 'container'" do
|
380
|
-
let(:public_access_level) { "container"}
|
381
|
-
before {
|
380
|
+
let(:public_access_level) { "container" }
|
381
|
+
before {
|
382
382
|
request_headers["x-ms-blob-public-access"] = public_access_level
|
383
383
|
}
|
384
384
|
|
385
385
|
it "sets the x-ms-blob-public-access header" do
|
386
|
-
subject.expects(:call).with(
|
386
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
387
387
|
subject.set_container_acl container_name, public_access_level
|
388
388
|
end
|
389
389
|
|
390
390
|
describe "when a signed_identifiers value is provided" do
|
391
|
-
let(:signed_identifier){ Azure::Service::SignedIdentifier.new }
|
392
|
-
let(:signed_identifiers){ [signed_identifier] }
|
391
|
+
let(:signed_identifier) { Azure::Service::SignedIdentifier.new }
|
392
|
+
let(:signed_identifiers) { [signed_identifier] }
|
393
393
|
before {
|
394
|
-
subject.stubs(:call).with(
|
394
|
+
subject.stubs(:call).with(verb, uri, request_body, request_headers).returns(response)
|
395
395
|
serialization.stubs(:signed_identifiers_to_xml).with(signed_identifiers).returns(request_body)
|
396
396
|
}
|
397
|
-
|
397
|
+
|
398
398
|
it "serializes the request contents" do
|
399
399
|
serialization.expects(:signed_identifiers_to_xml).with(signed_identifiers).returns(request_body)
|
400
|
-
subject.set_container_acl container_name, public_access_level, {
|
400
|
+
subject.set_container_acl container_name, public_access_level, {:signed_identifiers => signed_identifiers}
|
401
401
|
end
|
402
402
|
|
403
403
|
it "returns a container and an ACL" do
|
404
|
-
returned_container, returned_acl = subject.set_container_acl container_name, public_access_level, {
|
404
|
+
returned_container, returned_acl = subject.set_container_acl container_name, public_access_level, {:signed_identifiers => signed_identifiers}
|
405
405
|
|
406
406
|
returned_container.must_be_kind_of Azure::Blob::Container
|
407
407
|
returned_container.name.must_equal container_name
|
@@ -415,39 +415,39 @@ describe Azure::Blob::BlobService do
|
|
415
415
|
|
416
416
|
describe "when the public_access_level parameter is set to nil" do
|
417
417
|
let(:public_access_level) { nil }
|
418
|
-
before {
|
418
|
+
before {
|
419
419
|
request_headers.delete "x-ms-blob-public-access"
|
420
420
|
}
|
421
421
|
|
422
422
|
it "sets the x-ms-blob-public-access header" do
|
423
|
-
subject.expects(:call).with(
|
423
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
424
424
|
subject.set_container_acl container_name, public_access_level
|
425
425
|
end
|
426
426
|
end
|
427
427
|
|
428
428
|
describe "when the public_access_level parameter is set to empty string" do
|
429
429
|
let(:public_access_level) { "" }
|
430
|
-
before {
|
430
|
+
before {
|
431
431
|
request_headers.delete "x-ms-blob-public-access"
|
432
432
|
}
|
433
433
|
|
434
434
|
it "sets the x-ms-blob-public-access header" do
|
435
|
-
subject.expects(:call).with(
|
435
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
436
436
|
subject.set_container_acl container_name, public_access_level
|
437
437
|
end
|
438
438
|
end
|
439
439
|
end
|
440
440
|
|
441
441
|
describe "#set_container_metadata" do
|
442
|
-
let(:
|
443
|
-
let(:container_metadata) { {
|
444
|
-
let(:request_headers) { {
|
442
|
+
let(:verb) { :put }
|
443
|
+
let(:container_metadata) { {"MetadataKey" => "MetaDataValue", "MetadataKey1" => "MetaDataValue1"} }
|
444
|
+
let(:request_headers) { {"x-ms-meta-MetadataKey" => "MetaDataValue", "x-ms-meta-MetadataKey1" => "MetaDataValue1", 'x-ms-version' => '2013-08-15'} }
|
445
445
|
|
446
446
|
before {
|
447
|
-
query.update({
|
447
|
+
query.update({"comp" => "metadata"})
|
448
448
|
response.stubs(:success?).returns(true)
|
449
449
|
subject.stubs(:container_uri).with(container_name, query).returns(uri)
|
450
|
-
subject.stubs(:call).with(
|
450
|
+
subject.stubs(:call).with(verb, uri, nil, request_headers).returns(response)
|
451
451
|
}
|
452
452
|
|
453
453
|
it "assembles a URI for the request" do
|
@@ -456,7 +456,7 @@ describe Azure::Blob::BlobService do
|
|
456
456
|
end
|
457
457
|
|
458
458
|
it "calls StorageService#call with the prepared request" do
|
459
|
-
subject.expects(:call).with(
|
459
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
460
460
|
subject.set_container_metadata container_name, container_metadata
|
461
461
|
end
|
462
462
|
|
@@ -467,13 +467,13 @@ describe Azure::Blob::BlobService do
|
|
467
467
|
end
|
468
468
|
|
469
469
|
describe "#list_blobs" do
|
470
|
-
let(:
|
471
|
-
let(:query) {{"comp"=>"list"}}
|
472
|
-
let(:blob_enumeration_results) { Azure::Service::EnumerationResults.new}
|
470
|
+
let(:verb) { :get }
|
471
|
+
let(:query) { {"comp" => "list"} }
|
472
|
+
let(:blob_enumeration_results) { Azure::Service::EnumerationResults.new }
|
473
473
|
|
474
|
-
before {
|
474
|
+
before {
|
475
475
|
subject.stubs(:container_uri).with(container_name, query).returns(uri)
|
476
|
-
subject.stubs(:call).with(
|
476
|
+
subject.stubs(:call).with(verb, uri).returns(response)
|
477
477
|
serialization.stubs(:blob_enumeration_results_from_xml).with(response_body).returns(blob_enumeration_results)
|
478
478
|
}
|
479
479
|
|
@@ -483,7 +483,7 @@ describe Azure::Blob::BlobService do
|
|
483
483
|
end
|
484
484
|
|
485
485
|
it "calls StorageService#call with the prepared request" do
|
486
|
-
subject.expects(:call).with(
|
486
|
+
subject.expects(:call).with(verb, uri).returns(response)
|
487
487
|
subject.list_blobs container_name
|
488
488
|
end
|
489
489
|
|
@@ -506,97 +506,98 @@ describe Azure::Blob::BlobService do
|
|
506
506
|
|
507
507
|
it "modifies the URI query parameters when provided a :prefix value" do
|
508
508
|
query["prefix"]= "pre"
|
509
|
-
options = {
|
509
|
+
options = {:prefix => "pre"}
|
510
510
|
subject.list_blobs container_name, options
|
511
511
|
end
|
512
512
|
|
513
513
|
it "modifies the URI query parameters when provided a :prefix value" do
|
514
514
|
query["delimiter"] = "delim"
|
515
|
-
options = {
|
515
|
+
options = {:delimiter => "delim"}
|
516
516
|
subject.list_blobs container_name, options
|
517
517
|
end
|
518
|
-
|
518
|
+
|
519
519
|
it "modifies the URI query parameters when provided a :marker value" do
|
520
520
|
query["marker"] = "mark"
|
521
|
-
options = {
|
521
|
+
options = {:marker => "mark"}
|
522
522
|
subject.list_blobs container_name, options
|
523
523
|
end
|
524
|
-
|
524
|
+
|
525
525
|
it "modifies the URI query parameters when provided a :max_results value" do
|
526
526
|
query["maxresults"] = "5"
|
527
|
-
options = {
|
527
|
+
options = {:max_results => 5}
|
528
528
|
subject.list_blobs container_name, options
|
529
529
|
end
|
530
|
-
|
530
|
+
|
531
531
|
it "modifies the URI query parameters when provided a :metadata value" do
|
532
532
|
query["include"] = "metadata"
|
533
|
-
options = {
|
533
|
+
options = {:metadata => true}
|
534
534
|
subject.list_blobs container_name, options
|
535
535
|
end
|
536
536
|
|
537
537
|
it "modifies the URI query parameters when provided a :snapshots value" do
|
538
538
|
query["include"] = "snapshots"
|
539
|
-
options = {
|
539
|
+
options = {:snapshots => true}
|
540
540
|
subject.list_blobs container_name, options
|
541
541
|
end
|
542
542
|
|
543
543
|
it "modifies the URI query parameters when provided a :uncommittedblobs value" do
|
544
544
|
query["include"] = "uncommittedblobs"
|
545
|
-
options = {
|
545
|
+
options = {:uncommittedblobs => true}
|
546
546
|
subject.list_blobs container_name, options
|
547
547
|
end
|
548
548
|
|
549
549
|
it "modifies the URI query parameters when provided a :copy value" do
|
550
550
|
query["include"] = "copy"
|
551
|
-
options = {
|
551
|
+
options = {:copy => true}
|
552
552
|
subject.list_blobs container_name, options
|
553
553
|
end
|
554
|
-
|
554
|
+
|
555
555
|
it "modifies the URI query parameters when provided more than one of :metadata, :snapshots, :uncommittedblobs or :copy values" do
|
556
556
|
query["include"] = "metadata,snapshots,uncommittedblobs,copy"
|
557
557
|
|
558
|
-
options = {
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
558
|
+
options = {
|
559
|
+
:copy => true,
|
560
|
+
:metadata => true,
|
561
|
+
:snapshots => true,
|
562
|
+
:uncommittedblobs => true
|
563
563
|
}
|
564
564
|
|
565
565
|
subject.list_blobs container_name, options
|
566
566
|
end
|
567
567
|
|
568
568
|
it "modifies the URI query parameters when provided a :timeout value" do
|
569
|
-
query["timeout"] = "37"
|
570
|
-
options = {
|
569
|
+
query["timeout"] = "37"
|
570
|
+
options = {:timeout => 37}
|
571
571
|
subject.list_blobs container_name, options
|
572
572
|
end
|
573
573
|
|
574
574
|
it "does not modify the URI query parameters when provided an unknown value" do
|
575
|
-
options = {
|
575
|
+
options = {:unknown_key => "some_value"}
|
576
576
|
subject.list_blobs container_name, options
|
577
577
|
end
|
578
578
|
end
|
579
579
|
end
|
580
580
|
|
581
581
|
describe "blob functions" do
|
582
|
-
let(:blob_name){ "blob-name" }
|
582
|
+
let(:blob_name) { "blob-name" }
|
583
583
|
let(:blob) { Azure::Blob::Blob.new }
|
584
584
|
|
585
585
|
describe "#create_page_blob" do
|
586
|
-
let(:
|
586
|
+
let(:verb) { :put }
|
587
587
|
let(:blob_length) { 37 }
|
588
|
-
let(:request_headers) {
|
588
|
+
let(:request_headers) {
|
589
589
|
{
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
590
|
+
"x-ms-blob-type" => "PageBlob",
|
591
|
+
"Content-Length" => 0.to_s,
|
592
|
+
"x-ms-blob-content-length" => blob_length.to_s,
|
593
|
+
"x-ms-sequence-number" => 0.to_s,
|
594
|
+
'x-ms-version' => '2013-08-15'
|
594
595
|
}
|
595
596
|
}
|
596
597
|
|
597
598
|
before {
|
598
599
|
subject.stubs(:blob_uri).with(container_name, blob_name, {}).returns(uri)
|
599
|
-
subject.stubs(:call).with(
|
600
|
+
subject.stubs(:call).with(verb, uri, nil, request_headers).returns(response)
|
600
601
|
serialization.stubs(:blob_from_headers).with(response_headers).returns(blob)
|
601
602
|
}
|
602
603
|
|
@@ -606,7 +607,7 @@ describe Azure::Blob::BlobService do
|
|
606
607
|
end
|
607
608
|
|
608
609
|
it "calls StorageService#call with the prepared request" do
|
609
|
-
subject.expects(:call).with(
|
610
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
610
611
|
subject.create_page_blob container_name, blob_name, blob_length
|
611
612
|
end
|
612
613
|
|
@@ -620,89 +621,90 @@ describe Azure::Blob::BlobService do
|
|
620
621
|
describe "when the options Hash is used" do
|
621
622
|
it "modifies the request headers when provided a :sequence_number value" do
|
622
623
|
request_headers["x-ms-sequence-number"] = 37.to_s
|
623
|
-
subject.create_page_blob container_name, blob_name, blob_length, {
|
624
|
+
subject.create_page_blob container_name, blob_name, blob_length, {:sequence_number => 37.to_s}
|
624
625
|
end
|
625
626
|
|
626
627
|
it "modifies the request headers when provided a :blob_content_type value" do
|
627
628
|
request_headers["x-ms-blob-content-type"] = "bct-value"
|
628
|
-
subject.create_page_blob container_name, blob_name, blob_length, {
|
629
|
+
subject.create_page_blob container_name, blob_name, blob_length, {:blob_content_type => "bct-value"}
|
629
630
|
end
|
630
|
-
|
631
|
+
|
631
632
|
it "modifies the request headers when provided a :blob_content_encoding value" do
|
632
633
|
request_headers["x-ms-blob-content-encoding"] = "bce-value"
|
633
|
-
subject.create_page_blob container_name, blob_name, blob_length, {
|
634
|
+
subject.create_page_blob container_name, blob_name, blob_length, {:blob_content_encoding => "bce-value"}
|
634
635
|
end
|
635
636
|
|
636
637
|
it "modifies the request headers when provided a :blob_content_language value" do
|
637
638
|
request_headers["x-ms-blob-content-language"] = "bcl-value"
|
638
|
-
subject.create_page_blob container_name, blob_name, blob_length, {
|
639
|
+
subject.create_page_blob container_name, blob_name, blob_length, {:blob_content_language => "bcl-value"}
|
639
640
|
end
|
640
641
|
|
641
642
|
it "modifies the request headers when provided a :blob_content_md5 value" do
|
642
643
|
request_headers["x-ms-blob-content-md5"] = "bcm-value"
|
643
|
-
subject.create_page_blob container_name, blob_name, blob_length, {
|
644
|
+
subject.create_page_blob container_name, blob_name, blob_length, {:blob_content_md5 => "bcm-value"}
|
644
645
|
end
|
645
646
|
|
646
647
|
it "modifies the request headers when provided a :blob_cache_control value" do
|
647
648
|
request_headers["x-ms-blob-cache-control"] = "bcc-value"
|
648
|
-
subject.create_page_blob container_name, blob_name, blob_length, {
|
649
|
+
subject.create_page_blob container_name, blob_name, blob_length, {:blob_cache_control => "bcc-value"}
|
649
650
|
end
|
650
651
|
|
651
652
|
it "modifies the request headers when provided a :content_type value" do
|
652
653
|
request_headers["Content-Type"] = "ct-value"
|
653
|
-
subject.create_page_blob container_name, blob_name, blob_length, {
|
654
|
+
subject.create_page_blob container_name, blob_name, blob_length, {:content_type => "ct-value"}
|
654
655
|
end
|
655
|
-
|
656
|
+
|
656
657
|
it "modifies the request headers when provided a :content_encoding value" do
|
657
658
|
request_headers["Content-Encoding"] = "ce-value"
|
658
|
-
subject.create_page_blob container_name, blob_name, blob_length, {
|
659
|
+
subject.create_page_blob container_name, blob_name, blob_length, {:content_encoding => "ce-value"}
|
659
660
|
end
|
660
661
|
|
661
662
|
it "modifies the request headers when provided a :content_language value" do
|
662
663
|
request_headers["Content-Language"] = "cl-value"
|
663
|
-
subject.create_page_blob container_name, blob_name, blob_length, {
|
664
|
+
subject.create_page_blob container_name, blob_name, blob_length, {:content_language => "cl-value"}
|
664
665
|
end
|
665
666
|
|
666
667
|
it "modifies the request headers when provided a :content_md5 value" do
|
667
668
|
request_headers["Content-MD5"] = "cm-value"
|
668
|
-
subject.create_page_blob container_name, blob_name, blob_length, {
|
669
|
+
subject.create_page_blob container_name, blob_name, blob_length, {:content_md5 => "cm-value"}
|
669
670
|
end
|
670
671
|
|
671
672
|
it "modifies the request headers when provided a :cache_control value" do
|
672
673
|
request_headers["Cache-Control"] = "cc-value"
|
673
|
-
subject.create_page_blob container_name, blob_name, blob_length, {
|
674
|
+
subject.create_page_blob container_name, blob_name, blob_length, {:cache_control => "cc-value"}
|
674
675
|
end
|
675
676
|
|
676
677
|
it "modifies the request headers when provided a :metadata value" do
|
677
678
|
request_headers["x-ms-meta-MetadataKey"] = "MetaDataValue"
|
678
679
|
request_headers["x-ms-meta-MetadataKey1"] = "MetaDataValue1"
|
679
|
-
options = {
|
680
|
+
options = {:metadata => {"MetadataKey" => "MetaDataValue", "MetadataKey1" => "MetaDataValue1"}}
|
680
681
|
subject.create_page_blob container_name, blob_name, blob_length, options
|
681
682
|
end
|
682
683
|
|
683
684
|
it "does not modify the request headers when provided an unknown value" do
|
684
|
-
subject.create_page_blob container_name, blob_name, blob_length, {
|
685
|
+
subject.create_page_blob container_name, blob_name, blob_length, {:unknown_key => "some_value"}
|
685
686
|
end
|
686
687
|
end
|
687
688
|
end
|
688
689
|
|
689
690
|
describe "#create_blob_pages" do
|
690
|
-
let(:
|
691
|
+
let(:verb) { :put }
|
691
692
|
let(:start_range) { 255 }
|
692
693
|
let(:end_range) { 512 }
|
693
694
|
let(:content) { "some content" }
|
694
695
|
let(:query) { {"comp" => "page"} }
|
695
|
-
let(:request_headers) {
|
696
|
+
let(:request_headers) {
|
696
697
|
{
|
697
|
-
|
698
|
-
|
699
|
-
|
698
|
+
"x-ms-page-write" => "update",
|
699
|
+
"x-ms-range" => "bytes=#{start_range}-#{end_range}",
|
700
|
+
"Content-Type" => "",
|
701
|
+
'x-ms-version' => '2013-08-15'
|
700
702
|
}
|
701
703
|
}
|
702
704
|
|
703
705
|
before {
|
704
706
|
subject.stubs(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
705
|
-
subject.stubs(:call).with(
|
707
|
+
subject.stubs(:call).with(verb, uri, content, request_headers).returns(response)
|
706
708
|
serialization.stubs(:blob_from_headers).with(response_headers).returns(blob)
|
707
709
|
}
|
708
710
|
|
@@ -712,7 +714,7 @@ describe Azure::Blob::BlobService do
|
|
712
714
|
end
|
713
715
|
|
714
716
|
it "calls StorageService#call with the prepared request" do
|
715
|
-
subject.expects(:call).with(
|
717
|
+
subject.expects(:call).with(verb, uri, content, request_headers).returns(response)
|
716
718
|
subject.create_blob_pages container_name, blob_name, start_range, end_range, content
|
717
719
|
end
|
718
720
|
|
@@ -726,62 +728,63 @@ describe Azure::Blob::BlobService do
|
|
726
728
|
describe "when the options Hash is used" do
|
727
729
|
it "modifies the request headers when provided a :if_sequence_number_eq value" do
|
728
730
|
request_headers["x-ms-if-sequence-number-eq"] = "isne-value"
|
729
|
-
subject.create_blob_pages container_name, blob_name, start_range, end_range, content, {
|
731
|
+
subject.create_blob_pages container_name, blob_name, start_range, end_range, content, {:if_sequence_number_eq => "isne-value"}
|
730
732
|
end
|
731
733
|
|
732
734
|
it "modifies the request headers when provided a :if_sequence_number_lt value" do
|
733
735
|
request_headers["x-ms-if-sequence-number-lt"] = "isnlt-value"
|
734
|
-
subject.create_blob_pages container_name, blob_name, start_range, end_range, content, {
|
736
|
+
subject.create_blob_pages container_name, blob_name, start_range, end_range, content, {:if_sequence_number_lt => "isnlt-value"}
|
735
737
|
end
|
736
738
|
|
737
739
|
it "modifies the request headers when provided a :if_sequence_number_le value" do
|
738
740
|
request_headers["x-ms-if-sequence-number-le"] = "isnle-value"
|
739
|
-
subject.create_blob_pages container_name, blob_name, start_range, end_range, content, {
|
741
|
+
subject.create_blob_pages container_name, blob_name, start_range, end_range, content, {:if_sequence_number_le => "isnle-value"}
|
740
742
|
end
|
741
743
|
|
742
744
|
it "modifies the request headers when provided a :if_modified_since value" do
|
743
745
|
request_headers["If-Modified-Since"] = "ims-value"
|
744
|
-
subject.create_blob_pages container_name, blob_name, start_range, end_range, content, {
|
746
|
+
subject.create_blob_pages container_name, blob_name, start_range, end_range, content, {:if_modified_since => "ims-value"}
|
745
747
|
end
|
746
748
|
|
747
749
|
it "modifies the request headers when provided a :if_unmodified_since value" do
|
748
750
|
request_headers["If-Unmodified-Since"] = "iums-value"
|
749
|
-
subject.create_blob_pages container_name, blob_name, start_range, end_range, content, {
|
751
|
+
subject.create_blob_pages container_name, blob_name, start_range, end_range, content, {:if_unmodified_since => "iums-value"}
|
750
752
|
end
|
751
753
|
|
752
754
|
it "modifies the request headers when provided a :if_match value" do
|
753
755
|
request_headers["If-Match"] = "im-value"
|
754
|
-
subject.create_blob_pages container_name, blob_name, start_range, end_range, content, {
|
756
|
+
subject.create_blob_pages container_name, blob_name, start_range, end_range, content, {:if_match => "im-value"}
|
755
757
|
end
|
756
758
|
|
757
759
|
it "modifies the request headers when provided a :if_none_match value" do
|
758
760
|
request_headers["If-None-Match"] = "inm-value"
|
759
|
-
subject.create_blob_pages container_name, blob_name, start_range, end_range, content, {
|
761
|
+
subject.create_blob_pages container_name, blob_name, start_range, end_range, content, {:if_none_match => "inm-value"}
|
760
762
|
end
|
761
763
|
|
762
764
|
|
763
765
|
it "does not modify the request headers when provided an unknown value" do
|
764
|
-
subject.create_blob_pages container_name, blob_name, start_range, end_range, content, {
|
766
|
+
subject.create_blob_pages container_name, blob_name, start_range, end_range, content, {:unknown_key => "some_value"}
|
765
767
|
end
|
766
768
|
end
|
767
769
|
end
|
768
770
|
|
769
771
|
describe "#clear_blob_pages" do
|
770
|
-
let(:
|
772
|
+
let(:verb) { :put }
|
771
773
|
let(:query) { {"comp" => "page"} }
|
772
|
-
let(:start_range){ 255 }
|
773
|
-
let(:end_range){ 512 }
|
774
|
-
let(:request_headers) {
|
774
|
+
let(:start_range) { 255 }
|
775
|
+
let(:end_range) { 512 }
|
776
|
+
let(:request_headers) {
|
775
777
|
{
|
776
|
-
|
777
|
-
|
778
|
-
|
778
|
+
"x-ms-range" => "bytes=#{start_range}-#{end_range}",
|
779
|
+
"x-ms-page-write" => "clear",
|
780
|
+
"Content-Type" => "",
|
781
|
+
'x-ms-version' => '2013-08-15'
|
779
782
|
}
|
780
783
|
}
|
781
784
|
|
782
785
|
before {
|
783
786
|
subject.stubs(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
784
|
-
subject.stubs(:call).with(
|
787
|
+
subject.stubs(:call).with(verb, uri, nil, request_headers).returns(response)
|
785
788
|
serialization.stubs(:blob_from_headers).with(response_headers).returns(blob)
|
786
789
|
}
|
787
790
|
|
@@ -791,7 +794,7 @@ describe Azure::Blob::BlobService do
|
|
791
794
|
end
|
792
795
|
|
793
796
|
it "calls StorageService#call with the prepared request" do
|
794
|
-
subject.expects(:call).with(
|
797
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
795
798
|
subject.clear_blob_pages container_name, blob_name, start_range, end_range
|
796
799
|
end
|
797
800
|
|
@@ -807,7 +810,7 @@ describe Azure::Blob::BlobService do
|
|
807
810
|
# before { request_headers["x-ms-range"]="#{start_range}-" }
|
808
811
|
|
809
812
|
# it "modifies the request headers with the desired range" do
|
810
|
-
# subject.expects(:call).with(
|
813
|
+
# subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
811
814
|
# subject.clear_blob_pages container_name, blob_name, start_range
|
812
815
|
# end
|
813
816
|
# end
|
@@ -817,7 +820,7 @@ describe Azure::Blob::BlobService do
|
|
817
820
|
# before { request_headers["x-ms-range"]="0-#{end_range}" }
|
818
821
|
|
819
822
|
# it "modifies the request headers with the desired range" do
|
820
|
-
# subject.expects(:call).with(
|
823
|
+
# subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
821
824
|
# subject.clear_blob_pages container_name, blob_name, nil, end_range
|
822
825
|
# end
|
823
826
|
# end
|
@@ -826,7 +829,7 @@ describe Azure::Blob::BlobService do
|
|
826
829
|
# before { request_headers["x-ms-range"]="bytes=#{start_range}-#{end_range}" }
|
827
830
|
|
828
831
|
# it "modifies the request headers with the desired range" do
|
829
|
-
# subject.expects(:call).with(
|
832
|
+
# subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
830
833
|
# subject.clear_blob_pages container_name, blob_name, start_range, end_range
|
831
834
|
# end
|
832
835
|
# end
|
@@ -835,17 +838,17 @@ describe Azure::Blob::BlobService do
|
|
835
838
|
describe "#create_blob_block" do
|
836
839
|
require 'base64'
|
837
840
|
|
838
|
-
let(:
|
839
|
-
let(:content) { "some content"}
|
840
|
-
let(:block_id) { "block-id"}
|
841
|
+
let(:verb) { :put }
|
842
|
+
let(:content) { "some content" }
|
843
|
+
let(:block_id) { "block-id" }
|
841
844
|
let(:server_generated_content_md5) { "server-content-md5" }
|
842
|
-
let(:request_headers) { {} }
|
845
|
+
let(:request_headers) { {'x-ms-version' => '2013-08-15'} }
|
843
846
|
|
844
847
|
before {
|
845
|
-
query.update({
|
846
|
-
response_headers["Content-MD5"] = server_generated_content_md5
|
848
|
+
query.update({"comp" => "block", "blockid" => Base64.strict_encode64(block_id)})
|
849
|
+
response_headers["Content-MD5"] = server_generated_content_md5
|
847
850
|
subject.stubs(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
848
|
-
subject.stubs(:call).with(
|
851
|
+
subject.stubs(:call).with(verb, uri, content, request_headers).returns(response)
|
849
852
|
}
|
850
853
|
|
851
854
|
it "assembles a URI for the request" do
|
@@ -854,7 +857,7 @@ describe Azure::Blob::BlobService do
|
|
854
857
|
end
|
855
858
|
|
856
859
|
it "calls StorageService#call with the prepared request" do
|
857
|
-
subject.expects(:call).with(
|
860
|
+
subject.expects(:call).with(verb, uri, content, request_headers).returns(response)
|
858
861
|
subject.create_blob_block container_name, blob_name, block_id, content
|
859
862
|
end
|
860
863
|
|
@@ -866,28 +869,29 @@ describe Azure::Blob::BlobService do
|
|
866
869
|
describe "when the options Hash is used" do
|
867
870
|
it "modifies the request headers when provided a :content_md5 value" do
|
868
871
|
request_headers["Content-MD5"] = "content-md5"
|
869
|
-
subject.create_blob_block container_name, blob_name, block_id, content, {
|
872
|
+
subject.create_blob_block container_name, blob_name, block_id, content, {:content_md5 => "content-md5"}
|
870
873
|
end
|
871
|
-
|
874
|
+
|
872
875
|
it "does not modify the request headers when provided an unknown value" do
|
873
|
-
subject.create_blob_block container_name, blob_name, block_id, content, {
|
876
|
+
subject.create_blob_block container_name, blob_name, block_id, content, {:unknown_key => "some_value"}
|
874
877
|
end
|
875
878
|
end
|
876
879
|
end
|
877
880
|
|
878
881
|
describe "#create_block_blob" do
|
879
|
-
let(:
|
882
|
+
let(:verb) { :put }
|
880
883
|
let(:content) { "some content" }
|
881
|
-
let(:request_headers) {
|
884
|
+
let(:request_headers) {
|
882
885
|
{
|
883
|
-
|
884
|
-
|
886
|
+
"x-ms-blob-type" => "BlockBlob",
|
887
|
+
"Content-Type" => "application/octet-stream",
|
888
|
+
'x-ms-version' => '2013-08-15'
|
885
889
|
}
|
886
890
|
}
|
887
891
|
|
888
892
|
before {
|
889
893
|
subject.stubs(:blob_uri).with(container_name, blob_name, {}).returns(uri)
|
890
|
-
subject.stubs(:call).with(
|
894
|
+
subject.stubs(:call).with(verb, uri, content, request_headers).returns(response)
|
891
895
|
serialization.stubs(:blob_from_headers).with(response_headers).returns(blob)
|
892
896
|
}
|
893
897
|
|
@@ -897,7 +901,7 @@ describe Azure::Blob::BlobService do
|
|
897
901
|
end
|
898
902
|
|
899
903
|
it "calls StorageService#call with the prepared request" do
|
900
|
-
subject.expects(:call).with(
|
904
|
+
subject.expects(:call).with(verb, uri, content, request_headers).returns(response)
|
901
905
|
subject.create_block_blob container_name, blob_name, content
|
902
906
|
end
|
903
907
|
|
@@ -911,79 +915,84 @@ describe Azure::Blob::BlobService do
|
|
911
915
|
describe "when the options Hash is used" do
|
912
916
|
it "modifies the request headers when provided a :blob_content_type value" do
|
913
917
|
request_headers["x-ms-blob-content-type"] = "bct-value"
|
914
|
-
subject.create_block_blob container_name, blob_name, content, {
|
918
|
+
subject.create_block_blob container_name, blob_name, content, {:blob_content_type => "bct-value"}
|
915
919
|
end
|
916
|
-
|
920
|
+
|
917
921
|
it "modifies the request headers when provided a :blob_content_encoding value" do
|
918
922
|
request_headers["x-ms-blob-content-encoding"] = "bce-value"
|
919
|
-
subject.create_block_blob container_name, blob_name, content, {
|
923
|
+
subject.create_block_blob container_name, blob_name, content, {:blob_content_encoding => "bce-value"}
|
920
924
|
end
|
921
925
|
|
922
926
|
it "modifies the request headers when provided a :blob_content_language value" do
|
923
927
|
request_headers["x-ms-blob-content-language"] = "bcl-value"
|
924
|
-
subject.create_block_blob container_name, blob_name, content, {
|
928
|
+
subject.create_block_blob container_name, blob_name, content, {:blob_content_language => "bcl-value"}
|
925
929
|
end
|
926
930
|
|
927
931
|
it "modifies the request headers when provided a :blob_content_md5 value" do
|
928
932
|
request_headers["x-ms-blob-content-md5"] = "bcm-value"
|
929
|
-
subject.create_block_blob container_name, blob_name, content, {
|
933
|
+
subject.create_block_blob container_name, blob_name, content, {:blob_content_md5 => "bcm-value"}
|
930
934
|
end
|
931
935
|
|
932
936
|
it "modifies the request headers when provided a :blob_cache_control value" do
|
933
937
|
request_headers["x-ms-blob-cache-control"] = "bcc-value"
|
934
|
-
subject.create_block_blob container_name, blob_name, content, {
|
938
|
+
subject.create_block_blob container_name, blob_name, content, {:blob_cache_control => "bcc-value"}
|
939
|
+
end
|
940
|
+
|
941
|
+
it "modifies the request headers when provided a :blob_content_disposition value" do
|
942
|
+
request_headers["x-ms-blob-content-disposition"] = "bcd-value"
|
943
|
+
subject.create_block_blob container_name, blob_name, content, {:blob_content_disposition => "bcd-value"}
|
935
944
|
end
|
936
945
|
|
937
946
|
it "modifies the request headers when provided a :content_type value" do
|
938
947
|
request_headers["Content-Type"] = "ct-value"
|
939
|
-
subject.create_block_blob container_name, blob_name, content, {
|
948
|
+
subject.create_block_blob container_name, blob_name, content, {:content_type => "ct-value"}
|
940
949
|
end
|
941
|
-
|
950
|
+
|
942
951
|
it "modifies the request headers when provided a :content_encoding value" do
|
943
952
|
request_headers["Content-Encoding"] = "ce-value"
|
944
|
-
subject.create_block_blob container_name, blob_name, content, {
|
953
|
+
subject.create_block_blob container_name, blob_name, content, {:content_encoding => "ce-value"}
|
945
954
|
end
|
946
955
|
|
947
956
|
it "modifies the request headers when provided a :content_language value" do
|
948
957
|
request_headers["Content-Language"] = "cl-value"
|
949
|
-
subject.create_block_blob container_name, blob_name, content, {
|
958
|
+
subject.create_block_blob container_name, blob_name, content, {:content_language => "cl-value"}
|
950
959
|
end
|
951
960
|
|
952
961
|
it "modifies the request headers when provided a :content_md5 value" do
|
953
962
|
request_headers["Content-MD5"] = "cm-value"
|
954
|
-
subject.create_block_blob container_name, blob_name, content, {
|
963
|
+
subject.create_block_blob container_name, blob_name, content, {:content_md5 => "cm-value"}
|
955
964
|
end
|
956
965
|
|
957
966
|
it "modifies the request headers when provided a :cache_control value" do
|
958
967
|
request_headers["Cache-Control"] = "cc-value"
|
959
|
-
subject.create_block_blob container_name, blob_name, content, {
|
968
|
+
subject.create_block_blob container_name, blob_name, content, {:cache_control => "cc-value"}
|
960
969
|
end
|
961
970
|
|
962
971
|
it "modifies the request headers when provided a :metadata value" do
|
963
972
|
request_headers["x-ms-meta-MetadataKey"] = "MetaDataValue"
|
964
973
|
request_headers["x-ms-meta-MetadataKey1"] = "MetaDataValue1"
|
965
|
-
options = {
|
974
|
+
options = {:metadata => {"MetadataKey" => "MetaDataValue", "MetadataKey1" => "MetaDataValue1"}}
|
966
975
|
subject.create_block_blob container_name, blob_name, content, options
|
967
976
|
end
|
968
977
|
|
969
978
|
it "does not modify the request headers when provided an unknown value" do
|
970
|
-
subject.create_block_blob container_name, blob_name, content, {
|
979
|
+
subject.create_block_blob container_name, blob_name, content, {:unknown_key => "some_value"}
|
971
980
|
end
|
972
981
|
end
|
973
982
|
end
|
974
983
|
|
975
984
|
describe "#commit_blob_blocks" do
|
976
|
-
let(:
|
985
|
+
let(:verb) { :put }
|
977
986
|
let(:request_body) { "body" }
|
978
987
|
let(:block_list) { mock() }
|
979
|
-
let(:request_headers) { {} }
|
988
|
+
let(:request_headers) { {'x-ms-version' => '2013-08-15'} }
|
980
989
|
|
981
990
|
before {
|
982
|
-
query.update({
|
991
|
+
query.update({"comp" => "blocklist"})
|
983
992
|
response.stubs(:success?).returns(true)
|
984
993
|
subject.stubs(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
985
994
|
serialization.stubs(:block_list_to_xml).with(block_list).returns(request_body)
|
986
|
-
subject.stubs(:call).with(
|
995
|
+
subject.stubs(:call).with(verb, uri, request_body, request_headers).returns(response)
|
987
996
|
}
|
988
997
|
|
989
998
|
it "assembles a URI for the request" do
|
@@ -992,7 +1001,7 @@ describe Azure::Blob::BlobService do
|
|
992
1001
|
end
|
993
1002
|
|
994
1003
|
it "calls StorageService#call with the prepared request" do
|
995
|
-
subject.expects(:call).with(
|
1004
|
+
subject.expects(:call).with(verb, uri, request_body, request_headers).returns(response)
|
996
1005
|
subject.commit_blob_blocks container_name, blob_name, block_list
|
997
1006
|
end
|
998
1007
|
|
@@ -1009,55 +1018,60 @@ describe Azure::Blob::BlobService do
|
|
1009
1018
|
describe "when the options Hash is used" do
|
1010
1019
|
it "modifies the request headers when provided a :content_md5 value" do
|
1011
1020
|
request_headers["Content-MD5"] = "cm-value"
|
1012
|
-
subject.commit_blob_blocks container_name, blob_name, block_list, {
|
1021
|
+
subject.commit_blob_blocks container_name, blob_name, block_list, {:content_md5 => "cm-value"}
|
1013
1022
|
end
|
1014
1023
|
|
1015
1024
|
it "modifies the request headers when provided a :blob_content_type value" do
|
1016
1025
|
request_headers["x-ms-blob-content-type"] = "bct-value"
|
1017
|
-
subject.commit_blob_blocks container_name, blob_name, block_list, {
|
1026
|
+
subject.commit_blob_blocks container_name, blob_name, block_list, {:blob_content_type => "bct-value"}
|
1018
1027
|
end
|
1019
|
-
|
1028
|
+
|
1020
1029
|
it "modifies the request headers when provided a :blob_content_encoding value" do
|
1021
1030
|
request_headers["x-ms-blob-content-encoding"] = "bce-value"
|
1022
|
-
subject.commit_blob_blocks container_name, blob_name, block_list, {
|
1031
|
+
subject.commit_blob_blocks container_name, blob_name, block_list, {:blob_content_encoding => "bce-value"}
|
1023
1032
|
end
|
1024
1033
|
|
1025
1034
|
it "modifies the request headers when provided a :blob_content_language value" do
|
1026
1035
|
request_headers["x-ms-blob-content-language"] = "bcl-value"
|
1027
|
-
subject.commit_blob_blocks container_name, blob_name, block_list, {
|
1036
|
+
subject.commit_blob_blocks container_name, blob_name, block_list, {:blob_content_language => "bcl-value"}
|
1028
1037
|
end
|
1029
1038
|
|
1030
1039
|
it "modifies the request headers when provided a :blob_content_md5 value" do
|
1031
1040
|
request_headers["x-ms-blob-content-md5"] = "bcm-value"
|
1032
|
-
subject.commit_blob_blocks container_name, blob_name, block_list, {
|
1041
|
+
subject.commit_blob_blocks container_name, blob_name, block_list, {:blob_content_md5 => "bcm-value"}
|
1033
1042
|
end
|
1034
1043
|
|
1035
1044
|
it "modifies the request headers when provided a :blob_cache_control value" do
|
1036
1045
|
request_headers["x-ms-blob-cache-control"] = "bcc-value"
|
1037
|
-
subject.commit_blob_blocks container_name, blob_name, block_list, {
|
1046
|
+
subject.commit_blob_blocks container_name, blob_name, block_list, {:blob_cache_control => "bcc-value"}
|
1047
|
+
end
|
1048
|
+
|
1049
|
+
it "modifies the request headers when provided a :blob_content_disposition value" do
|
1050
|
+
request_headers["x-ms-blob-content-disposition"] = "bcd-value"
|
1051
|
+
subject.commit_blob_blocks container_name, blob_name, block_list, {:blob_content_disposition => "bcd-value"}
|
1038
1052
|
end
|
1039
1053
|
|
1040
1054
|
it "modifies the request headers when provided a :metadata value" do
|
1041
1055
|
request_headers["x-ms-meta-MetadataKey"] = "MetaDataValue"
|
1042
1056
|
request_headers["x-ms-meta-MetadataKey1"] = "MetaDataValue1"
|
1043
|
-
options = {
|
1057
|
+
options = {:metadata => {"MetadataKey" => "MetaDataValue", "MetadataKey1" => "MetaDataValue1"}}
|
1044
1058
|
subject.commit_blob_blocks container_name, blob_name, block_list, options
|
1045
1059
|
end
|
1046
1060
|
|
1047
1061
|
it "does not modify the request headers when provided an unknown value" do
|
1048
|
-
subject.commit_blob_blocks container_name, blob_name, block_list, {
|
1062
|
+
subject.commit_blob_blocks container_name, blob_name, block_list, {:unknown_key => "some_value"}
|
1049
1063
|
end
|
1050
1064
|
end
|
1051
1065
|
end
|
1052
1066
|
|
1053
1067
|
describe "#list_blob_blocks" do
|
1054
|
-
let(:
|
1055
|
-
let(:query) {{"comp"=>"blocklist", "blocklisttype"=>"all"}}
|
1068
|
+
let(:verb) { :get }
|
1069
|
+
let(:query) { {"comp" => "blocklist", "blocklisttype" => "all"} }
|
1056
1070
|
let(:blob_block_list) { [Azure::Blob::Block.new] }
|
1057
1071
|
|
1058
|
-
before {
|
1072
|
+
before {
|
1059
1073
|
subject.stubs(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1060
|
-
subject.stubs(:call).with(
|
1074
|
+
subject.stubs(:call).with(verb, uri).returns(response)
|
1061
1075
|
serialization.stubs(:block_list_from_xml).with(response_body).returns(blob_block_list)
|
1062
1076
|
}
|
1063
1077
|
|
@@ -1067,7 +1081,7 @@ describe Azure::Blob::BlobService do
|
|
1067
1081
|
end
|
1068
1082
|
|
1069
1083
|
it "calls StorageService#call with the prepared request" do
|
1070
|
-
subject.expects(:call).with(
|
1084
|
+
subject.expects(:call).with(verb, uri).returns(response)
|
1071
1085
|
subject.list_blob_blocks container_name, blob_name
|
1072
1086
|
end
|
1073
1087
|
|
@@ -1085,36 +1099,36 @@ describe Azure::Blob::BlobService do
|
|
1085
1099
|
describe "when blocklist_type is provided" do
|
1086
1100
|
it "modifies the request query when the value is :all" do
|
1087
1101
|
query["blocklisttype"] = "all"
|
1088
|
-
subject.list_blob_blocks container_name, blob_name, {
|
1102
|
+
subject.list_blob_blocks container_name, blob_name, {:blocklist_type => :all}
|
1089
1103
|
end
|
1090
1104
|
|
1091
1105
|
it "modifies the request query when the value is :uncommitted" do
|
1092
1106
|
query["blocklisttype"] = "uncommitted"
|
1093
|
-
subject.list_blob_blocks container_name, blob_name, {
|
1107
|
+
subject.list_blob_blocks container_name, blob_name, {:blocklist_type => :uncommitted}
|
1094
1108
|
end
|
1095
1109
|
|
1096
1110
|
it "modifies the request query when the value is :committed" do
|
1097
1111
|
query["blocklisttype"] = "committed"
|
1098
|
-
subject.list_blob_blocks container_name, blob_name, {
|
1112
|
+
subject.list_blob_blocks container_name, blob_name, {:blocklist_type => :committed}
|
1099
1113
|
end
|
1100
1114
|
end
|
1101
1115
|
|
1102
1116
|
describe "when snapshot is provided" do
|
1103
1117
|
it "modifies the request query with the provided value" do
|
1104
1118
|
query["snapshot"] = "snapshot-id"
|
1105
|
-
subject.list_blob_blocks container_name, blob_name, {
|
1119
|
+
subject.list_blob_blocks container_name, blob_name, {:snapshot => "snapshot-id"}
|
1106
1120
|
end
|
1107
1121
|
end
|
1108
1122
|
end
|
1109
1123
|
|
1110
1124
|
describe "#list_page_blob_ranges" do
|
1111
|
-
let(:
|
1112
|
-
let(:query) { {"comp"=>"pagelist"} }
|
1125
|
+
let(:verb) { :get }
|
1126
|
+
let(:query) { {"comp" => "pagelist"} }
|
1113
1127
|
let(:page_list) { [[0, 511], [512, 1023]] }
|
1114
1128
|
|
1115
|
-
before {
|
1129
|
+
before {
|
1116
1130
|
subject.stubs(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1117
|
-
subject.stubs(:call).with(
|
1131
|
+
subject.stubs(:call).with(verb, uri, nil, request_headers).returns(response)
|
1118
1132
|
serialization.stubs(:page_list_from_xml).with(response_body).returns(page_list)
|
1119
1133
|
}
|
1120
1134
|
|
@@ -1124,7 +1138,7 @@ describe Azure::Blob::BlobService do
|
|
1124
1138
|
end
|
1125
1139
|
|
1126
1140
|
it "calls StorageService#call with the prepared request" do
|
1127
|
-
subject.expects(:call).with(
|
1141
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1128
1142
|
subject.list_page_blob_ranges container_name, blob_name
|
1129
1143
|
end
|
1130
1144
|
|
@@ -1146,7 +1160,7 @@ describe Azure::Blob::BlobService do
|
|
1146
1160
|
# before { request_headers["x-ms-range"]="#{start_range}-" }
|
1147
1161
|
|
1148
1162
|
# it "modifies the request headers with the desired range" do
|
1149
|
-
# subject.expects(:call).with(
|
1163
|
+
# subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1150
1164
|
# subject.list_page_blob_ranges container_name, blob_name, start_range
|
1151
1165
|
# end
|
1152
1166
|
# end
|
@@ -1156,39 +1170,39 @@ describe Azure::Blob::BlobService do
|
|
1156
1170
|
# before { request_headers["x-ms-range"]="0-#{end_range}" }
|
1157
1171
|
|
1158
1172
|
# it "modifies the request headers with the desired range" do
|
1159
|
-
# subject.expects(:call).with(
|
1173
|
+
# subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1160
1174
|
# subject.list_page_blob_ranges container_name, blob_name, nil, end_range
|
1161
1175
|
# end
|
1162
1176
|
# end
|
1163
1177
|
|
1164
1178
|
describe "when both start_range and end_range are provided" do
|
1165
|
-
let(:start_range){ 255 }
|
1166
|
-
let(:end_range){ 512 }
|
1167
|
-
|
1179
|
+
let(:start_range) { 255 }
|
1180
|
+
let(:end_range) { 512 }
|
1181
|
+
let(:request_headers) { {'x-ms-range' => "bytes=#{start_range}-#{end_range}"} }
|
1168
1182
|
|
1169
1183
|
it "modifies the request headers with the desired range" do
|
1170
|
-
subject.expects(:call).with(
|
1171
|
-
subject.list_page_blob_ranges container_name, blob_name, {
|
1184
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1185
|
+
subject.list_page_blob_ranges container_name, blob_name, {:start_range => start_range, :end_range => end_range}
|
1172
1186
|
end
|
1173
1187
|
end
|
1174
1188
|
|
1175
1189
|
describe "when snapshot is provided" do
|
1176
1190
|
it "modifies the request query with the provided value" do
|
1177
1191
|
query["snapshot"] = "snapshot-id"
|
1178
|
-
subject.list_page_blob_ranges container_name, blob_name, {
|
1192
|
+
subject.list_page_blob_ranges container_name, blob_name, {:snapshot => "snapshot-id"}
|
1179
1193
|
end
|
1180
1194
|
end
|
1181
1195
|
end
|
1182
1196
|
|
1183
1197
|
describe "#set_blob_properties" do
|
1184
|
-
let(:
|
1185
|
-
let(:request_headers) { {} }
|
1198
|
+
let(:verb) { :put }
|
1199
|
+
let(:request_headers) { {'x-ms-version' => '2013-08-15'} }
|
1186
1200
|
|
1187
1201
|
before {
|
1188
|
-
query.update({
|
1202
|
+
query.update({"comp" => "properties"})
|
1189
1203
|
response.stubs(:success?).returns(true)
|
1190
1204
|
subject.stubs(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1191
|
-
subject.stubs(:call).with(
|
1205
|
+
subject.stubs(:call).with(verb, uri, nil, request_headers).returns(response)
|
1192
1206
|
}
|
1193
1207
|
|
1194
1208
|
it "assembles a URI for the request" do
|
@@ -1197,7 +1211,7 @@ describe Azure::Blob::BlobService do
|
|
1197
1211
|
end
|
1198
1212
|
|
1199
1213
|
it "calls StorageService#call with the prepared request" do
|
1200
|
-
subject.expects(:call).with(
|
1214
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1201
1215
|
subject.set_blob_properties container_name, blob_name
|
1202
1216
|
end
|
1203
1217
|
|
@@ -1209,60 +1223,65 @@ describe Azure::Blob::BlobService do
|
|
1209
1223
|
describe "when the options Hash is used" do
|
1210
1224
|
it "modifies the request headers when provided a :blob_content_type value" do
|
1211
1225
|
request_headers["x-ms-blob-content-type"] = "bct-value"
|
1212
|
-
subject.set_blob_properties container_name, blob_name, {
|
1226
|
+
subject.set_blob_properties container_name, blob_name, {:blob_content_type => "bct-value"}
|
1213
1227
|
end
|
1214
|
-
|
1228
|
+
|
1215
1229
|
it "modifies the request headers when provided a :blob_content_encoding value" do
|
1216
1230
|
request_headers["x-ms-blob-content-encoding"] = "bce-value"
|
1217
|
-
subject.set_blob_properties container_name, blob_name, {
|
1231
|
+
subject.set_blob_properties container_name, blob_name, {:blob_content_encoding => "bce-value"}
|
1218
1232
|
end
|
1219
1233
|
|
1220
1234
|
it "modifies the request headers when provided a :blob_content_language value" do
|
1221
1235
|
request_headers["x-ms-blob-content-language"] = "bcl-value"
|
1222
|
-
subject.set_blob_properties container_name, blob_name, {
|
1236
|
+
subject.set_blob_properties container_name, blob_name, {:blob_content_language => "bcl-value"}
|
1223
1237
|
end
|
1224
1238
|
|
1225
1239
|
it "modifies the request headers when provided a :blob_content_md5 value" do
|
1226
1240
|
request_headers["x-ms-blob-content-md5"] = "bcm-value"
|
1227
|
-
subject.set_blob_properties container_name, blob_name, {
|
1241
|
+
subject.set_blob_properties container_name, blob_name, {:blob_content_md5 => "bcm-value"}
|
1228
1242
|
end
|
1229
1243
|
|
1230
1244
|
it "modifies the request headers when provided a :blob_cache_control value" do
|
1231
1245
|
request_headers["x-ms-blob-cache-control"] = "bcc-value"
|
1232
|
-
subject.set_blob_properties container_name, blob_name, {
|
1246
|
+
subject.set_blob_properties container_name, blob_name, {:blob_cache_control => "bcc-value"}
|
1233
1247
|
end
|
1234
1248
|
|
1235
1249
|
it "modifies the request headers when provided a :blob_content_length value" do
|
1236
1250
|
request_headers["x-ms-blob-content-length"] = "37"
|
1237
|
-
subject.set_blob_properties container_name, blob_name, {
|
1251
|
+
subject.set_blob_properties container_name, blob_name, {:blob_content_length => 37.to_s}
|
1252
|
+
end
|
1253
|
+
|
1254
|
+
it "modifies the request headers when provided a :blob_content_disposition value" do
|
1255
|
+
request_headers["x-ms-blob-content-disposition"] = "bcd-value"
|
1256
|
+
subject.set_blob_properties container_name, blob_name, {:blob_content_disposition => "bcd-value"}
|
1238
1257
|
end
|
1239
1258
|
|
1240
1259
|
it "modifies the request headers when provided a :sequence_number_action value" do
|
1241
1260
|
request_headers["x-ms-blob-sequence-number-action"] = "anyvalue"
|
1242
|
-
subject.set_blob_properties container_name, blob_name, {
|
1261
|
+
subject.set_blob_properties container_name, blob_name, {:sequence_number_action => :anyvalue}
|
1243
1262
|
end
|
1244
1263
|
|
1245
1264
|
it "modifies the request headers when provided a :sequence_number value" do
|
1246
1265
|
request_headers["x-ms-blob-sequence-number"] = "37"
|
1247
|
-
subject.set_blob_properties container_name, blob_name, {
|
1266
|
+
subject.set_blob_properties container_name, blob_name, {:sequence_number => 37.to_s}
|
1248
1267
|
end
|
1249
1268
|
|
1250
1269
|
it "does not modify the request headers when provided an unknown value" do
|
1251
|
-
subject.set_blob_properties container_name, blob_name, {
|
1270
|
+
subject.set_blob_properties container_name, blob_name, {:unknown_key => "some_value"}
|
1252
1271
|
end
|
1253
1272
|
end
|
1254
1273
|
end
|
1255
1274
|
|
1256
1275
|
describe "#set_blob_metadata" do
|
1257
|
-
let(:
|
1258
|
-
let(:blob_metadata) { {
|
1259
|
-
let(:request_headers) { {
|
1276
|
+
let(:verb) { :put }
|
1277
|
+
let(:blob_metadata) { {"MetadataKey" => "MetaDataValue", "MetadataKey1" => "MetaDataValue1"} }
|
1278
|
+
let(:request_headers) { {"x-ms-meta-MetadataKey" => "MetaDataValue", "x-ms-meta-MetadataKey1" => "MetaDataValue1", 'x-ms-version' => '2013-08-15'} }
|
1260
1279
|
|
1261
1280
|
before {
|
1262
|
-
query.update({
|
1281
|
+
query.update({"comp" => "metadata"})
|
1263
1282
|
response.stubs(:success?).returns(true)
|
1264
1283
|
subject.stubs(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1265
|
-
subject.stubs(:call).with(
|
1284
|
+
subject.stubs(:call).with(verb, uri, nil, request_headers).returns(response)
|
1266
1285
|
}
|
1267
1286
|
|
1268
1287
|
it "assembles a URI for the request" do
|
@@ -1271,7 +1290,7 @@ describe Azure::Blob::BlobService do
|
|
1271
1290
|
end
|
1272
1291
|
|
1273
1292
|
it "calls StorageService#call with the prepared request" do
|
1274
|
-
subject.expects(:call).with(
|
1293
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1275
1294
|
subject.set_blob_metadata container_name, blob_name, blob_metadata
|
1276
1295
|
end
|
1277
1296
|
|
@@ -1282,121 +1301,121 @@ describe Azure::Blob::BlobService do
|
|
1282
1301
|
end
|
1283
1302
|
|
1284
1303
|
describe "#get_blob_properties" do
|
1285
|
-
let(:
|
1304
|
+
let(:verb) { :head }
|
1286
1305
|
|
1287
1306
|
before {
|
1288
1307
|
subject.stubs(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1289
|
-
subject.stubs(:call).with(
|
1308
|
+
subject.stubs(:call).with(verb, uri).returns(response)
|
1290
1309
|
serialization.stubs(:blob_from_headers).with(response_headers).returns(blob)
|
1291
1310
|
}
|
1292
|
-
|
1311
|
+
|
1293
1312
|
it "assembles a URI for the request" do
|
1294
1313
|
subject.expects(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1295
1314
|
subject.get_blob_properties container_name, blob_name
|
1296
1315
|
end
|
1297
1316
|
|
1298
1317
|
it "calls StorageService#call with the prepared request" do
|
1299
|
-
subject.expects(:call).with(
|
1318
|
+
subject.expects(:call).with(verb, uri).returns(response)
|
1300
1319
|
subject.get_blob_properties container_name, blob_name
|
1301
1320
|
end
|
1302
1321
|
|
1303
1322
|
it "returns the blob on success" do
|
1304
1323
|
result = subject.get_blob_properties container_name, blob_name
|
1305
|
-
|
1324
|
+
|
1306
1325
|
result.must_be_kind_of Azure::Blob::Blob
|
1307
1326
|
result.must_equal blob
|
1308
1327
|
result.name.must_equal blob_name
|
1309
1328
|
end
|
1310
1329
|
|
1311
1330
|
describe "when snapshot is provided" do
|
1312
|
-
let(:snapshot){ "snapshot" }
|
1331
|
+
let(:snapshot) { "snapshot" }
|
1313
1332
|
before { query["snapshot"]=snapshot }
|
1314
1333
|
|
1315
1334
|
it "modifies the blob uri query string with the snapshot" do
|
1316
1335
|
subject.expects(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1317
|
-
subject.get_blob_properties container_name, blob_name, {
|
1336
|
+
subject.get_blob_properties container_name, blob_name, {:snapshot => snapshot}
|
1318
1337
|
end
|
1319
1338
|
|
1320
1339
|
it "sets the snapshot value on the returned blob" do
|
1321
|
-
result = subject.get_blob_properties container_name, blob_name, {
|
1340
|
+
result = subject.get_blob_properties container_name, blob_name, {:snapshot => snapshot}
|
1322
1341
|
result.snapshot.must_equal snapshot
|
1323
1342
|
end
|
1324
1343
|
end
|
1325
1344
|
end
|
1326
1345
|
|
1327
1346
|
describe "#get_blob_metadata" do
|
1328
|
-
let(:
|
1347
|
+
let(:verb) { :get }
|
1329
1348
|
|
1330
1349
|
before {
|
1331
1350
|
query["comp"]="metadata"
|
1332
1351
|
|
1333
1352
|
subject.stubs(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1334
|
-
subject.stubs(:call).with(
|
1353
|
+
subject.stubs(:call).with(verb, uri).returns(response)
|
1335
1354
|
serialization.stubs(:blob_from_headers).with(response_headers).returns(blob)
|
1336
1355
|
}
|
1337
|
-
|
1356
|
+
|
1338
1357
|
it "assembles a URI for the request" do
|
1339
1358
|
subject.expects(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1340
1359
|
subject.get_blob_metadata container_name, blob_name
|
1341
1360
|
end
|
1342
1361
|
|
1343
1362
|
it "calls StorageService#call with the prepared request" do
|
1344
|
-
subject.expects(:call).with(
|
1363
|
+
subject.expects(:call).with(verb, uri).returns(response)
|
1345
1364
|
subject.get_blob_metadata container_name, blob_name
|
1346
1365
|
end
|
1347
1366
|
|
1348
1367
|
it "returns the blob on success" do
|
1349
1368
|
result = subject.get_blob_metadata container_name, blob_name
|
1350
|
-
|
1369
|
+
|
1351
1370
|
result.must_be_kind_of Azure::Blob::Blob
|
1352
1371
|
result.must_equal blob
|
1353
1372
|
result.name.must_equal blob_name
|
1354
1373
|
end
|
1355
1374
|
|
1356
1375
|
describe "when snapshot is provided" do
|
1357
|
-
let(:snapshot){ "snapshot" }
|
1358
|
-
before {
|
1359
|
-
query["snapshot"]=snapshot
|
1376
|
+
let(:snapshot) { "snapshot" }
|
1377
|
+
before {
|
1378
|
+
query["snapshot"]=snapshot
|
1360
1379
|
subject.stubs(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1361
1380
|
}
|
1362
1381
|
|
1363
1382
|
it "modifies the blob uri query string with the snapshot" do
|
1364
1383
|
subject.expects(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1365
|
-
subject.get_blob_metadata container_name, blob_name, {
|
1384
|
+
subject.get_blob_metadata container_name, blob_name, {:snapshot => snapshot}
|
1366
1385
|
end
|
1367
1386
|
|
1368
1387
|
it "sets the snapshot value on the returned blob" do
|
1369
|
-
result = subject.get_blob_metadata container_name, blob_name, {
|
1388
|
+
result = subject.get_blob_metadata container_name, blob_name, {:snapshot => snapshot}
|
1370
1389
|
result.snapshot.must_equal snapshot
|
1371
1390
|
end
|
1372
1391
|
end
|
1373
1392
|
end
|
1374
1393
|
|
1375
1394
|
describe "#get_blob" do
|
1376
|
-
let(:
|
1395
|
+
let(:verb) { :get }
|
1377
1396
|
|
1378
1397
|
before {
|
1379
1398
|
response.stubs(:success?).returns(true)
|
1380
1399
|
response_body = "body-contents"
|
1381
1400
|
|
1382
1401
|
subject.stubs(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1383
|
-
subject.stubs(:call).with(
|
1402
|
+
subject.stubs(:call).with(verb, uri, nil, request_headers).returns(response)
|
1384
1403
|
serialization.stubs(:blob_from_headers).with(response_headers).returns(blob)
|
1385
1404
|
}
|
1386
|
-
|
1405
|
+
|
1387
1406
|
it "assembles a URI for the request" do
|
1388
1407
|
subject.expects(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1389
1408
|
subject.get_blob container_name, blob_name
|
1390
1409
|
end
|
1391
1410
|
|
1392
1411
|
it "calls StorageService#call with the prepared request" do
|
1393
|
-
subject.expects(:call).with(
|
1412
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1394
1413
|
subject.get_blob container_name, blob_name
|
1395
1414
|
end
|
1396
1415
|
|
1397
1416
|
it "returns the blob and blob contents on success" do
|
1398
1417
|
returned_blob, returned_blob_contents = subject.get_blob container_name, blob_name
|
1399
|
-
|
1418
|
+
|
1400
1419
|
returned_blob.must_be_kind_of Azure::Blob::Blob
|
1401
1420
|
returned_blob.must_equal blob
|
1402
1421
|
|
@@ -1404,12 +1423,12 @@ describe Azure::Blob::BlobService do
|
|
1404
1423
|
end
|
1405
1424
|
|
1406
1425
|
describe "when snapshot is provided" do
|
1407
|
-
let(:source_snapshot){ "source-snapshot" }
|
1426
|
+
let(:source_snapshot) { "source-snapshot" }
|
1408
1427
|
before { query["snapshot"]=source_snapshot }
|
1409
1428
|
|
1410
1429
|
it "modifies the blob uri query string with the snapshot" do
|
1411
1430
|
subject.expects(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1412
|
-
subject.get_blob container_name, blob_name, {
|
1431
|
+
subject.get_blob container_name, blob_name, {:snapshot => source_snapshot}
|
1413
1432
|
end
|
1414
1433
|
end
|
1415
1434
|
|
@@ -1418,7 +1437,7 @@ describe Azure::Blob::BlobService do
|
|
1418
1437
|
# before { request_headers["x-ms-range"]="#{start_range}-" }
|
1419
1438
|
|
1420
1439
|
# it "modifies the request headers with the desired range" do
|
1421
|
-
# subject.expects(:call).with(
|
1440
|
+
# subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1422
1441
|
# subject.get_blob container_name, blob_name, start_range
|
1423
1442
|
# end
|
1424
1443
|
# end
|
@@ -1428,19 +1447,21 @@ describe Azure::Blob::BlobService do
|
|
1428
1447
|
# before { request_headers["x-ms-range"]="0-#{end_range}" }
|
1429
1448
|
|
1430
1449
|
# it "modifies the request headers with the desired range" do
|
1431
|
-
# subject.expects(:call).with(
|
1450
|
+
# subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1432
1451
|
# subject.get_blob container_name, blob_name, nil, end_range
|
1433
1452
|
# end
|
1434
1453
|
# end
|
1435
1454
|
|
1436
1455
|
describe "when both start_range and end_range are provided" do
|
1437
|
-
let(:start_range){ 255 }
|
1438
|
-
let(:end_range){ 512 }
|
1439
|
-
before {
|
1456
|
+
let(:start_range) { 255 }
|
1457
|
+
let(:end_range) { 512 }
|
1458
|
+
before {
|
1459
|
+
request_headers["x-ms-range"]="bytes=#{start_range}-#{end_range}"
|
1460
|
+
}
|
1440
1461
|
|
1441
1462
|
it "modifies the request headers with the desired range" do
|
1442
|
-
subject.expects(:call).with(
|
1443
|
-
subject.get_blob container_name, blob_name, {
|
1463
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1464
|
+
subject.get_blob container_name, blob_name, {:start_range => start_range, :end_range => end_range}
|
1444
1465
|
end
|
1445
1466
|
end
|
1446
1467
|
|
@@ -1448,46 +1469,47 @@ describe Azure::Blob::BlobService do
|
|
1448
1469
|
let(:get_content_md5) { true }
|
1449
1470
|
|
1450
1471
|
describe "and a range is specified" do
|
1451
|
-
let(:start_range){ 255 }
|
1452
|
-
let(:end_range){ 512 }
|
1453
|
-
before {
|
1472
|
+
let(:start_range) { 255 }
|
1473
|
+
let(:end_range) { 512 }
|
1474
|
+
before {
|
1454
1475
|
request_headers["x-ms-range"]="bytes=#{start_range}-#{end_range}"
|
1455
1476
|
request_headers["x-ms-range-get-content-md5"]= true
|
1456
1477
|
}
|
1457
1478
|
|
1458
1479
|
it "modifies the request headers to include the x-ms-range-get-content-md5 header" do
|
1459
|
-
subject.expects(:call).with(
|
1460
|
-
subject.get_blob container_name, blob_name, {
|
1480
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1481
|
+
subject.get_blob container_name, blob_name, {:start_range => start_range, :end_range => end_range, :get_content_md5 => true}
|
1461
1482
|
end
|
1462
1483
|
end
|
1463
1484
|
|
1464
1485
|
describe "and a range is NOT specified" do
|
1465
1486
|
it "does not modify the request headers" do
|
1466
|
-
subject.expects(:call).with(
|
1467
|
-
subject.get_blob container_name, blob_name, {
|
1487
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1488
|
+
subject.get_blob container_name, blob_name, {:get_content_md5 => true}
|
1468
1489
|
end
|
1469
1490
|
end
|
1470
1491
|
end
|
1471
1492
|
end
|
1472
1493
|
|
1473
1494
|
describe "#delete_blob" do
|
1474
|
-
let(:
|
1495
|
+
let(:verb) { :delete }
|
1475
1496
|
|
1476
1497
|
before {
|
1477
1498
|
response.stubs(:success?).returns(true)
|
1478
1499
|
request_headers["x-ms-delete-snapshots"] = "include"
|
1500
|
+
request_headers['x-ms-version'] = '2013-08-15'
|
1479
1501
|
|
1480
1502
|
subject.stubs(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1481
|
-
subject.stubs(:call).with(
|
1503
|
+
subject.stubs(:call).with(verb, uri, nil, request_headers).returns(response)
|
1482
1504
|
}
|
1483
|
-
|
1505
|
+
|
1484
1506
|
it "assembles a URI for the request" do
|
1485
1507
|
subject.expects(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1486
1508
|
subject.delete_blob container_name, blob_name
|
1487
1509
|
end
|
1488
1510
|
|
1489
1511
|
it "calls StorageService#call with the prepared request" do
|
1490
|
-
subject.expects(:call).with(
|
1512
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1491
1513
|
subject.delete_blob container_name, blob_name
|
1492
1514
|
end
|
1493
1515
|
|
@@ -1495,75 +1517,75 @@ describe Azure::Blob::BlobService do
|
|
1495
1517
|
result = subject.delete_blob container_name, blob_name
|
1496
1518
|
result.must_equal nil
|
1497
1519
|
end
|
1498
|
-
|
1520
|
+
|
1499
1521
|
describe "when snapshot is provided" do
|
1500
|
-
let(:source_snapshot){ "source-snapshot" }
|
1522
|
+
let(:source_snapshot) { "source-snapshot" }
|
1501
1523
|
before {
|
1502
1524
|
request_headers.delete "x-ms-delete-snapshots"
|
1503
|
-
query["snapshot"] = source_snapshot
|
1525
|
+
query["snapshot"] = source_snapshot
|
1504
1526
|
}
|
1505
1527
|
|
1506
1528
|
it "modifies the blob uri query string with the snapshot" do
|
1507
1529
|
subject.expects(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1508
|
-
subject.delete_blob container_name, blob_name, {
|
1530
|
+
subject.delete_blob container_name, blob_name, {:snapshot => source_snapshot}
|
1509
1531
|
end
|
1510
1532
|
|
1511
1533
|
it "does not include a x-ms-delete-snapshots header" do
|
1512
|
-
subject.expects(:call).with(
|
1513
|
-
subject.delete_blob container_name, blob_name, {
|
1534
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1535
|
+
subject.delete_blob container_name, blob_name, {:snapshot => source_snapshot}
|
1514
1536
|
end
|
1515
1537
|
end
|
1516
1538
|
|
1517
1539
|
describe "when delete_snapshots is provided" do
|
1518
|
-
let(:delete_snapshots){ :anyvalue }
|
1540
|
+
let(:delete_snapshots) { :anyvalue }
|
1519
1541
|
before { request_headers["x-ms-delete-snapshots"]=delete_snapshots.to_s }
|
1520
1542
|
|
1521
1543
|
it "modifies the request headers with the provided value" do
|
1522
|
-
subject.expects(:call).with(
|
1523
|
-
subject.delete_blob container_name, blob_name, {
|
1544
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1545
|
+
subject.delete_blob container_name, blob_name, {:delete_snapshots => delete_snapshots}
|
1524
1546
|
end
|
1525
1547
|
end
|
1526
1548
|
|
1527
1549
|
describe "when snapshot is provided and delete_snapshots is provided" do
|
1528
|
-
let(:source_snapshot){ "source-snapshot" }
|
1529
|
-
let(:delete_snapshots){ :anyvalue }
|
1550
|
+
let(:source_snapshot) { "source-snapshot" }
|
1551
|
+
let(:delete_snapshots) { :anyvalue }
|
1530
1552
|
before {
|
1531
1553
|
request_headers.delete "x-ms-delete-snapshots"
|
1532
|
-
query["snapshot"]=source_snapshot
|
1554
|
+
query["snapshot"]=source_snapshot
|
1533
1555
|
}
|
1534
1556
|
|
1535
1557
|
it "modifies the blob uri query string with the snapshot" do
|
1536
1558
|
subject.expects(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1537
|
-
subject.delete_blob container_name, blob_name, {
|
1559
|
+
subject.delete_blob container_name, blob_name, {:snapshot => source_snapshot, :delete_snapshots => delete_snapshots}
|
1538
1560
|
end
|
1539
1561
|
|
1540
1562
|
it "does not include a x-ms-delete-snapshots header" do
|
1541
|
-
subject.expects(:call).with(
|
1542
|
-
subject.delete_blob container_name, blob_name, {
|
1563
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1564
|
+
subject.delete_blob container_name, blob_name, {:snapshot => source_snapshot, :delete_snapshots => delete_snapshots}
|
1543
1565
|
end
|
1544
1566
|
end
|
1545
1567
|
end
|
1546
1568
|
|
1547
1569
|
describe "#create_blob_snapshot" do
|
1548
|
-
let(:
|
1570
|
+
let(:verb) { :put }
|
1549
1571
|
let(:snapshot_id) { "snapshot-id" }
|
1550
1572
|
|
1551
1573
|
before {
|
1552
1574
|
query["comp"] = "snapshot"
|
1553
|
-
|
1575
|
+
|
1554
1576
|
response_headers["x-ms-snapshot"] = snapshot_id
|
1555
1577
|
|
1556
1578
|
subject.stubs(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1557
|
-
subject.stubs(:call).with(
|
1579
|
+
subject.stubs(:call).with(verb, uri, nil, request_headers).returns(response)
|
1558
1580
|
}
|
1559
|
-
|
1581
|
+
|
1560
1582
|
it "assembles a URI for the request" do
|
1561
1583
|
subject.expects(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1562
1584
|
subject.create_blob_snapshot container_name, blob_name
|
1563
1585
|
end
|
1564
1586
|
|
1565
1587
|
it "calls StorageService#call with the prepared request" do
|
1566
|
-
subject.expects(:call).with(
|
1588
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1567
1589
|
subject.create_blob_snapshot container_name, blob_name
|
1568
1590
|
end
|
1569
1591
|
|
@@ -1574,49 +1596,49 @@ describe Azure::Blob::BlobService do
|
|
1574
1596
|
end
|
1575
1597
|
|
1576
1598
|
describe "when the options Hash is used" do
|
1577
|
-
before {
|
1578
|
-
subject.expects(:call).with(
|
1599
|
+
before {
|
1600
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1579
1601
|
}
|
1580
1602
|
|
1581
1603
|
it "modifies the request headers when provided a :if_modified_since value" do
|
1582
1604
|
request_headers["If-Modified-Since"] = "ims-value"
|
1583
|
-
subject.create_blob_snapshot container_name, blob_name, {
|
1605
|
+
subject.create_blob_snapshot container_name, blob_name, {:if_modified_since => "ims-value"}
|
1584
1606
|
end
|
1585
|
-
|
1607
|
+
|
1586
1608
|
it "modifies the request headers when provided a :if_unmodified_since value" do
|
1587
1609
|
request_headers["If-Unmodified-Since"] = "iums-value"
|
1588
|
-
subject.create_blob_snapshot container_name, blob_name, {
|
1610
|
+
subject.create_blob_snapshot container_name, blob_name, {:if_unmodified_since => "iums-value"}
|
1589
1611
|
end
|
1590
1612
|
|
1591
1613
|
it "modifies the request headers when provided a :if_match value" do
|
1592
1614
|
request_headers["If-Match"] = "im-value"
|
1593
|
-
subject.create_blob_snapshot container_name, blob_name, {
|
1615
|
+
subject.create_blob_snapshot container_name, blob_name, {:if_match => "im-value"}
|
1594
1616
|
end
|
1595
1617
|
|
1596
1618
|
it "modifies the request headers when provided a :if_none_match value" do
|
1597
1619
|
request_headers["If-None-Match"] = "inm-value"
|
1598
|
-
subject.create_blob_snapshot container_name, blob_name, {
|
1620
|
+
subject.create_blob_snapshot container_name, blob_name, {:if_none_match => "inm-value"}
|
1599
1621
|
end
|
1600
1622
|
|
1601
1623
|
it "modifies the request headers when provided a :metadata value" do
|
1602
1624
|
request_headers["x-ms-meta-MetadataKey"] = "MetaDataValue"
|
1603
1625
|
request_headers["x-ms-meta-MetadataKey1"] = "MetaDataValue1"
|
1604
|
-
options = {
|
1626
|
+
options = {:metadata => {"MetadataKey" => "MetaDataValue", "MetadataKey1" => "MetaDataValue1"}}
|
1605
1627
|
subject.create_blob_snapshot container_name, blob_name, options
|
1606
1628
|
end
|
1607
1629
|
|
1608
1630
|
it "does not modify the request headers when provided an unknown value" do
|
1609
|
-
subject.create_blob_snapshot container_name, blob_name, {
|
1631
|
+
subject.create_blob_snapshot container_name, blob_name, {:unknown_key => "some_value"}
|
1610
1632
|
end
|
1611
1633
|
end
|
1612
1634
|
end
|
1613
1635
|
|
1614
1636
|
describe "#copy_blob" do
|
1615
|
-
let(:
|
1637
|
+
let(:verb) { :put }
|
1616
1638
|
let(:source_container_name) { "source-container-name" }
|
1617
1639
|
let(:source_blob_name) { "source-blob-name" }
|
1618
1640
|
let(:source_uri) { URI.parse("http://dummy.uri/source") }
|
1619
|
-
|
1641
|
+
|
1620
1642
|
let(:copy_id) { "copy-id" }
|
1621
1643
|
let(:copy_status) { "copy-status" }
|
1622
1644
|
|
@@ -1628,9 +1650,9 @@ describe Azure::Blob::BlobService do
|
|
1628
1650
|
|
1629
1651
|
subject.stubs(:blob_uri).with(container_name, blob_name, {}).returns(uri)
|
1630
1652
|
subject.stubs(:blob_uri).with(source_container_name, source_blob_name, query).returns(source_uri)
|
1631
|
-
subject.stubs(:call).with(
|
1653
|
+
subject.stubs(:call).with(verb, uri, nil, request_headers).returns(response)
|
1632
1654
|
}
|
1633
|
-
|
1655
|
+
|
1634
1656
|
it "assembles a URI for the request" do
|
1635
1657
|
subject.expects(:blob_uri).with(container_name, blob_name, {}).returns(uri)
|
1636
1658
|
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name
|
@@ -1642,7 +1664,7 @@ describe Azure::Blob::BlobService do
|
|
1642
1664
|
end
|
1643
1665
|
|
1644
1666
|
it "calls StorageService#call with the prepared request" do
|
1645
|
-
subject.expects(:call).with(
|
1667
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1646
1668
|
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name
|
1647
1669
|
end
|
1648
1670
|
|
@@ -1651,85 +1673,85 @@ describe Azure::Blob::BlobService do
|
|
1651
1673
|
returned_copy_id.must_equal copy_id
|
1652
1674
|
returned_copy_status.must_equal copy_status
|
1653
1675
|
end
|
1654
|
-
|
1676
|
+
|
1655
1677
|
describe "when snapshot is provided" do
|
1656
|
-
let(:source_snapshot){"source-snapshot"}
|
1657
|
-
before {
|
1678
|
+
let(:source_snapshot) { "source-snapshot" }
|
1679
|
+
before {
|
1658
1680
|
query["snapshot"]=source_snapshot
|
1659
1681
|
}
|
1660
1682
|
|
1661
1683
|
it "modifies the source blob uri query string with the snapshot" do
|
1662
1684
|
subject.expects(:blob_uri).with(source_container_name, source_blob_name, query).returns(source_uri)
|
1663
|
-
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {
|
1685
|
+
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {:source_snapshot => source_snapshot}
|
1664
1686
|
end
|
1665
1687
|
end
|
1666
1688
|
|
1667
1689
|
describe "when the options Hash is used" do
|
1668
|
-
before {
|
1669
|
-
subject.expects(:call).with(
|
1690
|
+
before {
|
1691
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1670
1692
|
}
|
1671
1693
|
|
1672
1694
|
it "modifies the request headers when provided a :dest_if_modified_since value" do
|
1673
1695
|
request_headers["If-Modified-Since"] = "ims-value"
|
1674
|
-
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {
|
1696
|
+
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {:dest_if_modified_since => "ims-value"}
|
1675
1697
|
end
|
1676
|
-
|
1698
|
+
|
1677
1699
|
it "modifies the request headers when provided a :dest_if_unmodified_since value" do
|
1678
1700
|
request_headers["If-Unmodified-Since"] = "iums-value"
|
1679
|
-
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {
|
1701
|
+
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {:dest_if_unmodified_since => "iums-value"}
|
1680
1702
|
end
|
1681
1703
|
|
1682
1704
|
it "modifies the request headers when provided a :dest_if_match value" do
|
1683
1705
|
request_headers["If-Match"] = "im-value"
|
1684
|
-
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {
|
1706
|
+
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {:dest_if_match => "im-value"}
|
1685
1707
|
end
|
1686
1708
|
|
1687
1709
|
it "modifies the request headers when provided a :dest_if_none_match value" do
|
1688
1710
|
request_headers["If-None-Match"] = "inm-value"
|
1689
|
-
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {
|
1711
|
+
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {:dest_if_none_match => "inm-value"}
|
1690
1712
|
end
|
1691
1713
|
|
1692
1714
|
it "modifies the request headers when provided a :source_if_modified_since value" do
|
1693
1715
|
request_headers["x-ms-source-if-modified-since"] = "ims-value"
|
1694
|
-
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {
|
1716
|
+
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {:source_if_modified_since => "ims-value"}
|
1695
1717
|
end
|
1696
|
-
|
1718
|
+
|
1697
1719
|
it "modifies the request headers when provided a :source_if_unmodified_since value" do
|
1698
1720
|
request_headers["x-ms-source-if-unmodified-since"] = "iums-value"
|
1699
|
-
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {
|
1721
|
+
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {:source_if_unmodified_since => "iums-value"}
|
1700
1722
|
end
|
1701
1723
|
|
1702
1724
|
it "modifies the request headers when provided a :source_if_match value" do
|
1703
1725
|
request_headers["x-ms-source-if-match"] = "im-value"
|
1704
|
-
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {
|
1726
|
+
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {:source_if_match => "im-value"}
|
1705
1727
|
end
|
1706
1728
|
|
1707
1729
|
it "modifies the request headers when provided a :source_if_none_match value" do
|
1708
1730
|
request_headers["x-ms-source-if-none-match"] = "inm-value"
|
1709
|
-
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {
|
1731
|
+
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {:source_if_none_match => "inm-value"}
|
1710
1732
|
end
|
1711
1733
|
|
1712
1734
|
it "modifies the request headers when provided a :metadata value" do
|
1713
1735
|
request_headers["x-ms-meta-MetadataKey"] = "MetaDataValue"
|
1714
1736
|
request_headers["x-ms-meta-MetadataKey1"] = "MetaDataValue1"
|
1715
|
-
options = {
|
1737
|
+
options = {:metadata => {"MetadataKey" => "MetaDataValue", "MetadataKey1" => "MetaDataValue1"}}
|
1716
1738
|
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, options
|
1717
1739
|
end
|
1718
1740
|
|
1719
1741
|
it "does not modify the request headers when provided an unknown value" do
|
1720
|
-
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {
|
1742
|
+
subject.copy_blob container_name, blob_name, source_container_name, source_blob_name, {:unknown_key => "some_value"}
|
1721
1743
|
end
|
1722
1744
|
end
|
1723
1745
|
end
|
1724
1746
|
|
1725
|
-
describe "lease functions" do
|
1726
|
-
let(:
|
1747
|
+
describe "lease functions" do
|
1748
|
+
let(:verb) { :put }
|
1727
1749
|
let(:lease_id) { "lease-id" }
|
1728
|
-
|
1729
|
-
before {
|
1730
|
-
query.update({"comp"=>"lease"})
|
1750
|
+
|
1751
|
+
before {
|
1752
|
+
query.update({"comp" => "lease"})
|
1731
1753
|
subject.stubs(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1732
|
-
subject.stubs(:call).with(
|
1754
|
+
subject.stubs(:call).with(verb, uri, nil, request_headers).returns(response)
|
1733
1755
|
}
|
1734
1756
|
|
1735
1757
|
describe "#acquire_lease" do
|
@@ -1740,14 +1762,14 @@ describe Azure::Blob::BlobService do
|
|
1740
1762
|
response.stubs(:success?).returns(true)
|
1741
1763
|
response_headers["x-ms-lease-id"] = lease_id
|
1742
1764
|
}
|
1743
|
-
|
1765
|
+
|
1744
1766
|
it "assembles a URI for the request" do
|
1745
1767
|
subject.expects(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1746
1768
|
subject.acquire_lease container_name, blob_name
|
1747
1769
|
end
|
1748
1770
|
|
1749
1771
|
it "calls StorageService#call with the prepared request" do
|
1750
|
-
subject.expects(:call).with(
|
1772
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1751
1773
|
subject.acquire_lease container_name, blob_name
|
1752
1774
|
end
|
1753
1775
|
|
@@ -1761,8 +1783,8 @@ describe Azure::Blob::BlobService do
|
|
1761
1783
|
before { request_headers["x-ms-lease-duration"] = "37" }
|
1762
1784
|
|
1763
1785
|
it "modifies the headers to include the provided duration value" do
|
1764
|
-
subject.expects(:call).with(
|
1765
|
-
subject.acquire_lease container_name, blob_name, {
|
1786
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1787
|
+
subject.acquire_lease container_name, blob_name, {:duration => duration}
|
1766
1788
|
end
|
1767
1789
|
end
|
1768
1790
|
|
@@ -1772,8 +1794,8 @@ describe Azure::Blob::BlobService do
|
|
1772
1794
|
before { request_headers["x-ms-proposed-lease-id"] = proposed_lease_id }
|
1773
1795
|
|
1774
1796
|
it "modifies the headers to include the proposed lease id" do
|
1775
|
-
subject.expects(:call).with(
|
1776
|
-
subject.acquire_lease container_name, blob_name, {
|
1797
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1798
|
+
subject.acquire_lease container_name, blob_name, {:duration => default_duration, :proposed_lease_id => proposed_lease_id}
|
1777
1799
|
end
|
1778
1800
|
end
|
1779
1801
|
end
|
@@ -1786,14 +1808,14 @@ describe Azure::Blob::BlobService do
|
|
1786
1808
|
response.stubs(:success?).returns(true)
|
1787
1809
|
response_headers["x-ms-lease-id"] = lease_id
|
1788
1810
|
}
|
1789
|
-
|
1811
|
+
|
1790
1812
|
it "assembles a URI for the request" do
|
1791
1813
|
subject.expects(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1792
1814
|
subject.renew_lease container_name, blob_name, lease_id
|
1793
1815
|
end
|
1794
1816
|
|
1795
1817
|
it "calls StorageService#call with the prepared request" do
|
1796
|
-
subject.expects(:call).with(
|
1818
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1797
1819
|
subject.renew_lease container_name, blob_name, lease_id
|
1798
1820
|
end
|
1799
1821
|
|
@@ -1810,14 +1832,14 @@ describe Azure::Blob::BlobService do
|
|
1810
1832
|
|
1811
1833
|
response.stubs(:success?).returns(true)
|
1812
1834
|
}
|
1813
|
-
|
1835
|
+
|
1814
1836
|
it "assembles a URI for the request" do
|
1815
1837
|
subject.expects(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1816
1838
|
subject.release_lease container_name, blob_name, lease_id
|
1817
1839
|
end
|
1818
1840
|
|
1819
1841
|
it "calls StorageService#call with the prepared request" do
|
1820
|
-
subject.expects(:call).with(
|
1842
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1821
1843
|
subject.release_lease container_name, blob_name, lease_id
|
1822
1844
|
end
|
1823
1845
|
|
@@ -1835,14 +1857,14 @@ describe Azure::Blob::BlobService do
|
|
1835
1857
|
response.stubs(:success?).returns(true)
|
1836
1858
|
response_headers["x-ms-lease-time"] = lease_time.to_s
|
1837
1859
|
}
|
1838
|
-
|
1860
|
+
|
1839
1861
|
it "assembles a URI for the request" do
|
1840
1862
|
subject.expects(:blob_uri).with(container_name, blob_name, query).returns(uri)
|
1841
1863
|
subject.break_lease container_name, blob_name
|
1842
1864
|
end
|
1843
1865
|
|
1844
1866
|
it "calls StorageService#call with the prepared request" do
|
1845
|
-
subject.expects(:call).with(
|
1867
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1846
1868
|
subject.break_lease container_name, blob_name
|
1847
1869
|
end
|
1848
1870
|
|
@@ -1856,8 +1878,8 @@ describe Azure::Blob::BlobService do
|
|
1856
1878
|
before { request_headers["x-ms-lease-break-period"] = break_period.to_s }
|
1857
1879
|
|
1858
1880
|
it "modifies the request headers to include a break period" do
|
1859
|
-
subject.expects(:call).with(
|
1860
|
-
subject.break_lease container_name, blob_name, {
|
1881
|
+
subject.expects(:call).with(verb, uri, nil, request_headers).returns(response)
|
1882
|
+
subject.break_lease container_name, blob_name, {:break_period => break_period}
|
1861
1883
|
end
|
1862
1884
|
end
|
1863
1885
|
end
|
@@ -1884,10 +1906,10 @@ describe Azure::Blob::BlobService do
|
|
1884
1906
|
|
1885
1907
|
let(:container_name) { "container" }
|
1886
1908
|
let(:blob_name) { "blob" }
|
1887
|
-
let(:query) { {
|
1909
|
+
let(:query) { {"param" => "value", "param 1" => "value 1"} }
|
1888
1910
|
let(:host_uri) { "http://dummy.uri" }
|
1889
1911
|
|
1890
|
-
before {
|
1912
|
+
before {
|
1891
1913
|
subject.host = host_uri
|
1892
1914
|
}
|
1893
1915
|
|
@@ -1929,7 +1951,7 @@ describe Azure::Blob::BlobService do
|
|
1929
1951
|
end
|
1930
1952
|
end
|
1931
1953
|
|
1932
|
-
describe "#blob_uri" do
|
1954
|
+
describe "#blob_uri" do
|
1933
1955
|
it "returns a blob URI" do
|
1934
1956
|
result = subject.blob_uri container_name, blob_name
|
1935
1957
|
result.must_be_kind_of URI
|