azure 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/azure.gemspec +1 -1
- data/lib/azure.rb +1 -0
- data/lib/azure/blob/blob.rb +1 -1
- data/lib/azure/blob/blob_service.rb +14 -9
- data/lib/azure/blob/block.rb +2 -2
- data/lib/azure/blob/serialization.rb +6 -6
- data/lib/azure/configurable.rb +8 -0
- data/lib/azure/core/filtered_service.rb +1 -1
- data/lib/azure/core/http/debug_filter.rb +2 -2
- data/lib/azure/core/http/http_error.rb +1 -1
- data/lib/azure/core/http/http_filter.rb +15 -15
- data/lib/azure/core/http/http_request.rb +6 -6
- data/lib/azure/core/http/http_response.rb +1 -1
- data/lib/azure/core/http/retry_policy.rb +12 -12
- data/lib/azure/core/http/signer_filter.rb +1 -1
- data/lib/azure/core/service.rb +1 -1
- data/lib/azure/queue/queue_service.rb +91 -91
- data/lib/azure/queue/serialization.rb +1 -1
- data/lib/azure/service/cors.rb +1 -1
- data/lib/azure/service/logging.rb +1 -1
- data/lib/azure/service/metrics.rb +1 -1
- data/lib/azure/service/serialization.rb +10 -10
- data/lib/azure/service/signed_identifier.rb +1 -1
- data/lib/azure/service/storage_service.rb +2 -2
- data/lib/azure/service_bus/auth/wrap_service.rb +2 -2
- data/lib/azure/service_bus/brokered_message.rb +6 -6
- data/lib/azure/service_bus/interval.rb +2 -2
- data/lib/azure/service_bus/queue.rb +11 -11
- data/lib/azure/service_bus/relay.rb +4 -4
- data/lib/azure/service_bus/resource.rb +1 -1
- data/lib/azure/service_bus/rule.rb +1 -1
- data/lib/azure/service_bus/serialization.rb +2 -2
- data/lib/azure/service_bus/service_bus_service.rb +92 -92
- data/lib/azure/service_bus/sql_filter.rb +1 -1
- data/lib/azure/service_bus/sql_rule_action.rb +3 -3
- data/lib/azure/service_bus/subscription.rb +1 -1
- data/lib/azure/service_bus/topic.rb +11 -11
- data/lib/azure/storage_management/storage_management_service.rb +2 -2
- data/lib/azure/table/batch.rb +28 -28
- data/lib/azure/table/batch_response.rb +5 -5
- data/lib/azure/table/edmtype.rb +1 -1
- data/lib/azure/table/entity.rb +2 -2
- data/lib/azure/table/query.rb +6 -6
- data/lib/azure/table/serialization.rb +4 -4
- data/lib/azure/table/table_service.rb +30 -30
- data/lib/azure/version.rb +1 -1
- data/lib/azure/virtual_machine_management/virtual_machine_management_service.rb +5 -4
- data/lib/azure/virtual_network_management/serialization.rb +2 -2
- data/test/fixtures/list_os_images.xml +1 -1
- data/test/fixtures/list_virtual_networks.xml +0 -1
- data/test/fixtures/management_certificate.pem +55 -0
- data/test/fixtures/management_certificate.publishsettings +12 -0
- data/test/fixtures/updated_storage_accounts.xml +8 -8
- data/test/integration/blob/blob_metadata_test.rb +5 -5
- data/test/integration/blob/blob_pages_test.rb +5 -5
- data/test/integration/blob/blob_properties_test.rb +3 -3
- data/test/integration/blob/block_blob_test.rb +64 -15
- data/test/integration/blob/container/container_acl_test.rb +2 -2
- data/test/integration/blob/container/container_metadata_test.rb +2 -2
- data/test/integration/blob/container/create_container_test.rb +3 -3
- data/test/integration/blob/container/delete_container_test.rb +1 -1
- data/test/integration/blob/container/get_container_properties_test.rb +2 -2
- data/test/integration/blob/container/list_containers_test.rb +3 -3
- data/test/integration/blob/copy_blob_test.rb +4 -4
- data/test/integration/blob/create_blob_snapshot_test.rb +2 -2
- data/test/integration/blob/create_page_blob_test.rb +2 -2
- data/test/integration/blob/delete_blob_test.rb +4 -4
- data/test/integration/blob/get_blob_test.rb +7 -7
- data/test/integration/blob/informative_errors_test.rb +2 -2
- data/test/integration/blob/lease/acquire_lease_test.rb +1 -1
- data/test/integration/blob/lease/break_lease_test.rb +2 -2
- data/test/integration/blob/lease/release_lease_test.rb +2 -2
- data/test/integration/blob/lease/renew_lease_test.rb +2 -2
- data/test/integration/blob/list_blobs_test.rb +1 -1
- data/test/integration/database/delete_sql_server_firewall_test.rb +0 -1
- data/test/integration/database/delete_sql_server_test.rb +0 -1
- data/test/integration/location/Location_List_test.rb +0 -1
- data/test/integration/location/RoleSize_List_test.rb +0 -1
- data/test/integration/queue/clear_messages_test.rb +3 -3
- data/test/integration/queue/create_message_test.rb +5 -5
- data/test/integration/queue/create_queue_test.rb +1 -1
- data/test/integration/queue/delete_message_test.rb +4 -4
- data/test/integration/queue/delete_queue_test.rb +1 -1
- data/test/integration/queue/informative_errors_test.rb +2 -2
- data/test/integration/queue/list_messages_encoded_test.rb +2 -2
- data/test/integration/queue/list_messages_test.rb +3 -3
- data/test/integration/queue/list_queues_test.rb +1 -1
- data/test/integration/queue/peek_messages_test.rb +3 -3
- data/test/integration/queue/queue_metadata_test.rb +4 -4
- data/test/integration/queue/update_message_test.rb +4 -4
- data/test/integration/service_bus/informative_errors_test.rb +1 -1
- data/test/integration/service_bus/queues_test.rb +6 -6
- data/test/integration/service_bus/relay_test.rb +3 -3
- data/test/integration/service_bus/rules_test.rb +2 -2
- data/test/integration/service_bus/subscriptions_test.rb +4 -4
- data/test/integration/service_bus/topics_test.rb +2 -2
- data/test/integration/table/delete_entity_batch_test.rb +3 -3
- data/test/integration/table/delete_entity_test.rb +3 -3
- data/test/integration/table/delete_table_test.rb +1 -1
- data/test/integration/table/get_table_test.rb +4 -4
- data/test/integration/table/informative_errors_test.rb +2 -2
- data/test/integration/table/insert_entity_batch_test.rb +3 -3
- data/test/integration/table/insert_entity_test.rb +3 -3
- data/test/integration/table/insert_or_merge_entity_batch_test.rb +7 -7
- data/test/integration/table/insert_or_merge_entity_test.rb +8 -8
- data/test/integration/table/insert_or_replace_entity_batch_test.rb +7 -7
- data/test/integration/table/insert_or_replace_entity_test.rb +7 -7
- data/test/integration/table/merge_entity_batch_test.rb +1 -1
- data/test/integration/table/merge_entity_test.rb +1 -1
- data/test/integration/table/query_entities_test.rb +21 -21
- data/test/integration/table/query_tables_test.rb +2 -2
- data/test/integration/table/query_test.rb +21 -21
- data/test/integration/table/table_acl_test.rb +4 -4
- data/test/integration/table/update_entity_batch_test.rb +6 -6
- data/test/integration/table/update_entity_test.rb +8 -8
- data/test/unit/config/azure_test.rb +19 -0
- data/test/unit/core/auth/shared_key_lite_test.rb +3 -3
- data/test/unit/core/auth/shared_key_test.rb +2 -2
- data/test/unit/service/serialization_test.rb +44 -44
- metadata +4 -6
- data/.gitignore +0 -30
- data/.travis.yml +0 -13
- data/ChangeLog.txt +0 -56
- data/README.md +0 -702
@@ -16,12 +16,12 @@ require 'integration/test_helper'
|
|
16
16
|
require 'azure/table/table_service'
|
17
17
|
require 'azure/core/http/http_error'
|
18
18
|
|
19
|
-
describe Azure::Table::TableService do
|
19
|
+
describe Azure::Table::TableService do
|
20
20
|
describe '#get/set_acl' do
|
21
21
|
subject { Azure::Table::TableService.new }
|
22
22
|
let(:table_name){ TableNameHelper.name }
|
23
|
-
let(:signed_identifier) {
|
24
|
-
identifier = Azure::Service::SignedIdentifier.new
|
23
|
+
let(:signed_identifier) {
|
24
|
+
identifier = Azure::Service::SignedIdentifier.new
|
25
25
|
identifier.id = 'MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI='
|
26
26
|
identifier.access_policy = Azure::Service::AccessPolicy.new
|
27
27
|
identifier.access_policy.start = '2009-09-28T08:49:37.0000000Z'
|
@@ -30,7 +30,7 @@ describe Azure::Table::TableService do
|
|
30
30
|
identifier
|
31
31
|
}
|
32
32
|
|
33
|
-
before {
|
33
|
+
before {
|
34
34
|
subject.create_table table_name
|
35
35
|
}
|
36
36
|
after { TableNameHelper.clean }
|
@@ -22,8 +22,8 @@ describe Azure::Table::TableService do
|
|
22
22
|
subject { Azure::Table::TableService.new }
|
23
23
|
let(:table_name){ TableNameHelper.name }
|
24
24
|
|
25
|
-
let(:entity_properties){
|
26
|
-
{
|
25
|
+
let(:entity_properties){
|
26
|
+
{
|
27
27
|
"PartitionKey" => "testingpartition",
|
28
28
|
"RowKey" => "abcd1234_existing",
|
29
29
|
"CustomStringProperty" => "CustomPropertyValue",
|
@@ -51,7 +51,7 @@ describe Azure::Table::TableService do
|
|
51
51
|
|
52
52
|
after { TableNameHelper.clean }
|
53
53
|
|
54
|
-
it "updates an existing entity, removing any properties not included in the update operation" do
|
54
|
+
it "updates an existing entity, removing any properties not included in the update operation" do
|
55
55
|
batch = Azure::Table::Batch.new table_name, entity_properties["PartitionKey"]
|
56
56
|
batch.update entity_properties["RowKey"], {
|
57
57
|
"PartitionKey" => entity_properties["PartitionKey"],
|
@@ -65,7 +65,7 @@ describe Azure::Table::TableService do
|
|
65
65
|
etags[0].wont_equal @existing_etag
|
66
66
|
|
67
67
|
result = subject.get_entity table_name, entity_properties["PartitionKey"], entity_properties["RowKey"]
|
68
|
-
|
68
|
+
|
69
69
|
result.must_be_kind_of Azure::Table::Entity
|
70
70
|
result.table.must_equal table_name
|
71
71
|
|
@@ -78,7 +78,7 @@ describe Azure::Table::TableService do
|
|
78
78
|
result.properties["NewCustomProperty"].must_equal "NewCustomValue"
|
79
79
|
end
|
80
80
|
|
81
|
-
it "updates an existing entity, removing any properties not included in the update operation and adding nil one" do
|
81
|
+
it "updates an existing entity, removing any properties not included in the update operation and adding nil one" do
|
82
82
|
batch = Azure::Table::Batch.new table_name, entity_properties["PartitionKey"]
|
83
83
|
batch.update entity_properties["RowKey"], {
|
84
84
|
"PartitionKey" => entity_properties["PartitionKey"],
|
@@ -92,7 +92,7 @@ describe Azure::Table::TableService do
|
|
92
92
|
etags[0].wont_equal @existing_etag
|
93
93
|
|
94
94
|
result = subject.get_entity table_name, entity_properties["PartitionKey"], entity_properties["RowKey"]
|
95
|
-
|
95
|
+
|
96
96
|
result.must_be_kind_of Azure::Table::Entity
|
97
97
|
result.table.must_equal table_name
|
98
98
|
|
@@ -21,8 +21,8 @@ describe Azure::Table::TableService do
|
|
21
21
|
subject { Azure::Table::TableService.new }
|
22
22
|
let(:table_name){ TableNameHelper.name }
|
23
23
|
|
24
|
-
let(:entity_properties){
|
25
|
-
{
|
24
|
+
let(:entity_properties){
|
25
|
+
{
|
26
26
|
"PartitionKey" => "testingpartition",
|
27
27
|
"RowKey" => "abcd1234_existing",
|
28
28
|
"CustomStringProperty" => "CustomPropertyValue",
|
@@ -50,8 +50,8 @@ describe Azure::Table::TableService do
|
|
50
50
|
|
51
51
|
after { TableNameHelper.clean }
|
52
52
|
|
53
|
-
it "updates an existing entity, removing any properties not included in the update operation" do
|
54
|
-
etag = subject.update_entity table_name, {
|
53
|
+
it "updates an existing entity, removing any properties not included in the update operation" do
|
54
|
+
etag = subject.update_entity table_name, {
|
55
55
|
"PartitionKey" => entity_properties["PartitionKey"],
|
56
56
|
"RowKey" => entity_properties["RowKey"],
|
57
57
|
"NewCustomProperty" => "NewCustomValue"
|
@@ -61,7 +61,7 @@ describe Azure::Table::TableService do
|
|
61
61
|
etag.wont_equal @existing_etag
|
62
62
|
|
63
63
|
result = subject.get_entity table_name, entity_properties["PartitionKey"], entity_properties["RowKey"]
|
64
|
-
|
64
|
+
|
65
65
|
result.must_be_kind_of Azure::Table::Entity
|
66
66
|
result.table.must_equal table_name
|
67
67
|
|
@@ -74,8 +74,8 @@ describe Azure::Table::TableService do
|
|
74
74
|
result.properties["NewCustomProperty"].must_equal "NewCustomValue"
|
75
75
|
end
|
76
76
|
|
77
|
-
it "updates an existing entity, removing any properties not included in the update operation and adding nil one" do
|
78
|
-
etag = subject.update_entity table_name, {
|
77
|
+
it "updates an existing entity, removing any properties not included in the update operation and adding nil one" do
|
78
|
+
etag = subject.update_entity table_name, {
|
79
79
|
"PartitionKey" => entity_properties["PartitionKey"],
|
80
80
|
"RowKey" => entity_properties["RowKey"],
|
81
81
|
"NewCustomProperty" => nil
|
@@ -85,7 +85,7 @@ describe Azure::Table::TableService do
|
|
85
85
|
etag.wont_equal @existing_etag
|
86
86
|
|
87
87
|
result = subject.get_entity table_name, entity_properties["PartitionKey"], entity_properties["RowKey"]
|
88
|
-
|
88
|
+
|
89
89
|
result.must_be_kind_of Azure::Table::Entity
|
90
90
|
result.table.must_equal table_name
|
91
91
|
|
@@ -106,6 +106,25 @@ describe Azure do
|
|
106
106
|
end
|
107
107
|
end
|
108
108
|
end
|
109
|
+
|
110
|
+
describe 'using a publishsettings' do
|
111
|
+
|
112
|
+
describe 'loaded as a file' do
|
113
|
+
before do
|
114
|
+
Azure.management_certificate = Fixtures['management_certificate.publishsettings']
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'should populate the private key' do
|
118
|
+
refute_nil(private_key)
|
119
|
+
private_key.must_be_kind_of(OpenSSL::PKey::RSA)
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'should populate the public key' do
|
123
|
+
refute_nil(public_key)
|
124
|
+
public_key.must_be_kind_of(OpenSSL::X509::Certificate)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
109
128
|
end
|
110
129
|
end
|
111
130
|
|
@@ -17,7 +17,7 @@ require 'azure/core/auth/shared_key_lite'
|
|
17
17
|
|
18
18
|
describe Azure::Core::Auth::SharedKeyLite do
|
19
19
|
subject { Azure::Core::Auth::SharedKeyLite.new 'account-name', 'YWNjZXNzLWtleQ==' }
|
20
|
-
|
20
|
+
|
21
21
|
let(:verb) { 'POST' }
|
22
22
|
let(:uri) { URI.parse 'http://dummy.uri/resource' }
|
23
23
|
let(:headers) do
|
@@ -27,12 +27,12 @@ describe Azure::Core::Auth::SharedKeyLite do
|
|
27
27
|
'Date' => 'foo'
|
28
28
|
}
|
29
29
|
end
|
30
|
-
let(:headers_without_date) {
|
30
|
+
let(:headers_without_date) {
|
31
31
|
headers_without_date = headers.clone
|
32
32
|
headers_without_date.delete 'Date'
|
33
33
|
headers_without_date
|
34
34
|
}
|
35
|
-
|
35
|
+
|
36
36
|
describe 'sign' do
|
37
37
|
it 'creates a signature from the provided HTTP method, uri, and reduced set of standard headers' do
|
38
38
|
subject.sign(verb, uri, headers).must_equal 'account-name:vVFnj/+27JFABZgpt5H8g/JVU2HuWFnjv5aeUIxQvBE='
|
@@ -17,7 +17,7 @@ require 'azure/core/auth/shared_key'
|
|
17
17
|
|
18
18
|
describe Azure::Core::Auth::SharedKey do
|
19
19
|
subject { Azure::Core::Auth::SharedKey.new 'account-name', 'YWNjZXNzLWtleQ==' }
|
20
|
-
|
20
|
+
|
21
21
|
let(:verb) { 'POST' }
|
22
22
|
let(:uri) { URI.parse 'http://dummy.uri/resource' }
|
23
23
|
let(:headers) do
|
@@ -43,7 +43,7 @@ describe Azure::Core::Auth::SharedKey do
|
|
43
43
|
subject.sign(verb, uri, headers).must_equal 'account-name:vcdxlDVoE1QvJerkg0ci3Wlnj2Qq8yzlsrkRf5dEU/I='
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
describe 'canonicalized_headers' do
|
48
48
|
it 'creates a canonicalized header string' do
|
49
49
|
subject.canonicalized_headers(headers).must_equal "x-ms-imateapot:teapot\nx-ms-shortandstout:True"
|
@@ -36,7 +36,7 @@ describe Azure::Service::Serialization do
|
|
36
36
|
it "accepts an XML string" do
|
37
37
|
subject.signed_identifiers_from_xml signed_identifiers_xml
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
it "returns an Array of SignedIdentifier instances" do
|
41
41
|
results = subject.signed_identifiers_from_xml signed_identifiers_xml
|
42
42
|
results.must_be_kind_of Array
|
@@ -46,7 +46,7 @@ describe Azure::Service::Serialization do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
describe "#signed_identifiers_to_xml" do
|
49
|
-
let(:signed_identifiers) {
|
49
|
+
let(:signed_identifiers) {
|
50
50
|
identifier = Azure::Service::SignedIdentifier.new
|
51
51
|
identifier.id = "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="
|
52
52
|
identifier.access_policy.start = "2009-09-28T08:49:37.0000000Z"
|
@@ -54,9 +54,9 @@ describe Azure::Service::Serialization do
|
|
54
54
|
identifier.access_policy.permission = "rwd"
|
55
55
|
[identifier]
|
56
56
|
}
|
57
|
-
|
57
|
+
|
58
58
|
let(:signed_identifiers_xml) { Fixtures["container_acl"]}
|
59
|
-
|
59
|
+
|
60
60
|
it "accepts a list of SignedIdentifier instances" do
|
61
61
|
subject.signed_identifiers_to_xml signed_identifiers
|
62
62
|
end
|
@@ -75,7 +75,7 @@ describe Azure::Service::Serialization do
|
|
75
75
|
it "accepts an XML node" do
|
76
76
|
subject.signed_identifier_from_xml signed_identifier_xml
|
77
77
|
end
|
78
|
-
|
78
|
+
|
79
79
|
it "returns a SignedIdentifier instance" do
|
80
80
|
identifier = subject.signed_identifier_from_xml signed_identifier_xml
|
81
81
|
identifier.must_be_kind_of Azure::Service::SignedIdentifier
|
@@ -94,7 +94,7 @@ describe Azure::Service::Serialization do
|
|
94
94
|
it "accepts an XML node" do
|
95
95
|
subject.access_policy_from_xml access_policy_xml
|
96
96
|
end
|
97
|
-
|
97
|
+
|
98
98
|
it "returns a AccessPolicy instance" do
|
99
99
|
access_policy = subject.access_policy_from_xml access_policy_xml
|
100
100
|
access_policy.must_be_kind_of Azure::Service::AccessPolicy
|
@@ -115,7 +115,7 @@ describe Azure::Service::Serialization do
|
|
115
115
|
|
116
116
|
describe "when passed an instance of EnumerationResults" do
|
117
117
|
let(:enumeration_results) { Azure::Service::EnumerationResults.new }
|
118
|
-
|
118
|
+
|
119
119
|
it "parses the XML and populates the provided EnumerationResults instance" do
|
120
120
|
result = subject.enumeration_results_from_xml enumeration_results_xml, enumeration_results
|
121
121
|
result.must_be :kind_of?, Azure::Service::EnumerationResults
|
@@ -189,16 +189,16 @@ describe Azure::Service::Serialization do
|
|
189
189
|
end
|
190
190
|
|
191
191
|
describe "#retention_policy_to_xml" do
|
192
|
-
let(:retention_policy) {
|
192
|
+
let(:retention_policy) {
|
193
193
|
retention_policy = Azure::Service::RetentionPolicy.new
|
194
194
|
retention_policy.enabled = true
|
195
195
|
retention_policy.days = 7
|
196
|
-
|
196
|
+
|
197
197
|
retention_policy
|
198
198
|
}
|
199
|
-
|
199
|
+
|
200
200
|
let(:retention_policy_xml) { Fixtures["retention_policy"]}
|
201
|
-
|
201
|
+
|
202
202
|
it "accepts a RetentionPolicy instance and an Nokogiri::XML::Builder instance" do
|
203
203
|
Nokogiri::XML::Builder.new do |xml|
|
204
204
|
subject.retention_policy_to_xml retention_policy, xml
|
@@ -215,11 +215,11 @@ describe Azure::Service::Serialization do
|
|
215
215
|
|
216
216
|
describe "#retention_policy_from_xml" do
|
217
217
|
let(:retention_policy_xml) { Nokogiri.Slop(Fixtures["storage_service_properties"]).root.HourMetrics.RetentionPolicy }
|
218
|
-
|
218
|
+
|
219
219
|
it "accepts an XML Node" do
|
220
220
|
subject.retention_policy_from_xml retention_policy_xml
|
221
221
|
end
|
222
|
-
|
222
|
+
|
223
223
|
it "returns an RetentionPolicy instance" do
|
224
224
|
retention_policy = subject.retention_policy_from_xml retention_policy_xml
|
225
225
|
retention_policy.wont_be_nil
|
@@ -234,7 +234,7 @@ describe Azure::Service::Serialization do
|
|
234
234
|
end
|
235
235
|
|
236
236
|
describe "#hour_metrics_to_xml" do
|
237
|
-
let(:metrics) {
|
237
|
+
let(:metrics) {
|
238
238
|
metrics = Azure::Service::Metrics.new
|
239
239
|
metrics.version = "1.0"
|
240
240
|
metrics.enabled = true
|
@@ -242,12 +242,12 @@ describe Azure::Service::Serialization do
|
|
242
242
|
retention_policy = metrics.retention_policy = Azure::Service::RetentionPolicy.new
|
243
243
|
retention_policy.enabled = true
|
244
244
|
retention_policy.days = 7
|
245
|
-
|
245
|
+
|
246
246
|
metrics
|
247
247
|
}
|
248
|
-
|
248
|
+
|
249
249
|
let(:metrics_xml) { Fixtures["metrics"]}
|
250
|
-
|
250
|
+
|
251
251
|
it "accepts a Metrics instance and an Nokogiri::XML::Builder instance" do
|
252
252
|
Nokogiri::XML::Builder.new do |xml|
|
253
253
|
subject.hour_metrics_to_xml metrics, xml
|
@@ -261,19 +261,19 @@ describe Azure::Service::Serialization do
|
|
261
261
|
builder.to_xml.must_equal metrics_xml
|
262
262
|
end
|
263
263
|
end
|
264
|
-
|
264
|
+
|
265
265
|
describe "#metrics_from_xml" do
|
266
266
|
let(:metrics_xml) { Nokogiri.Slop(Fixtures["storage_service_properties"]).root.HourMetrics }
|
267
267
|
let(:mock_retention_policy) { mock }
|
268
268
|
|
269
|
-
before {
|
269
|
+
before {
|
270
270
|
subject.expects(:retention_policy_from_xml).returns(mock_retention_policy)
|
271
271
|
}
|
272
|
-
|
272
|
+
|
273
273
|
it "accepts an XML Node" do
|
274
274
|
subject.metrics_from_xml metrics_xml
|
275
275
|
end
|
276
|
-
|
276
|
+
|
277
277
|
it "returns an Metrics instance" do
|
278
278
|
metrics = subject.metrics_from_xml metrics_xml
|
279
279
|
metrics.wont_be_nil
|
@@ -289,9 +289,9 @@ describe Azure::Service::Serialization do
|
|
289
289
|
end
|
290
290
|
end
|
291
291
|
|
292
|
-
|
292
|
+
|
293
293
|
describe "#logging_to_xml" do
|
294
|
-
let(:logging) {
|
294
|
+
let(:logging) {
|
295
295
|
logging = Azure::Service::Logging.new
|
296
296
|
logging.version = "1.0"
|
297
297
|
logging.delete = true
|
@@ -301,12 +301,12 @@ describe Azure::Service::Serialization do
|
|
301
301
|
retention_policy = logging.retention_policy = Azure::Service::RetentionPolicy.new
|
302
302
|
retention_policy.enabled = true
|
303
303
|
retention_policy.days = 7
|
304
|
-
|
304
|
+
|
305
305
|
logging
|
306
306
|
}
|
307
|
-
|
307
|
+
|
308
308
|
let(:logging_xml) { Fixtures["logging"]}
|
309
|
-
|
309
|
+
|
310
310
|
it "accepts a Logging instance and an Nokogiri::XML::Builder instance" do
|
311
311
|
Nokogiri::XML::Builder.new do |xml|
|
312
312
|
subject.logging_to_xml logging, xml
|
@@ -325,14 +325,14 @@ describe Azure::Service::Serialization do
|
|
325
325
|
let(:logging_xml) { Nokogiri.Slop(Fixtures["storage_service_properties"]).root.Logging }
|
326
326
|
let(:mock_retention_policy) { mock }
|
327
327
|
|
328
|
-
before {
|
328
|
+
before {
|
329
329
|
subject.expects(:retention_policy_from_xml).returns(mock_retention_policy)
|
330
330
|
}
|
331
|
-
|
331
|
+
|
332
332
|
it "accepts an XML Node" do
|
333
333
|
subject.logging_from_xml logging_xml
|
334
334
|
end
|
335
|
-
|
335
|
+
|
336
336
|
it "returns an Logging instance" do
|
337
337
|
logging = subject.logging_from_xml logging_xml
|
338
338
|
logging.wont_be_nil
|
@@ -350,7 +350,7 @@ describe Azure::Service::Serialization do
|
|
350
350
|
end
|
351
351
|
|
352
352
|
describe "#service_properties_to_xml" do
|
353
|
-
let(:service_properties) {
|
353
|
+
let(:service_properties) {
|
354
354
|
service_properties = Azure::Service::StorageServiceProperties.new
|
355
355
|
service_properties.default_service_version = "2011-08-18"
|
356
356
|
logging = service_properties.logging = Azure::Service::Logging.new
|
@@ -401,9 +401,9 @@ describe Azure::Service::Serialization do
|
|
401
401
|
|
402
402
|
service_properties
|
403
403
|
}
|
404
|
-
|
404
|
+
|
405
405
|
let(:service_properties_xml) { Fixtures["storage_service_properties"]}
|
406
|
-
|
406
|
+
|
407
407
|
it "accepts a StorageServiceProperties instance" do
|
408
408
|
subject.service_properties_to_xml service_properties
|
409
409
|
end
|
@@ -420,16 +420,16 @@ describe Azure::Service::Serialization do
|
|
420
420
|
let(:mock_metrics) { mock }
|
421
421
|
let(:mock_cors) { mock }
|
422
422
|
|
423
|
-
before {
|
423
|
+
before {
|
424
424
|
subject.expects(:logging_from_xml).returns(mock_logging)
|
425
425
|
subject.expects(:metrics_from_xml).twice.returns(mock_metrics)
|
426
426
|
subject.expects(:cors_from_xml).returns(mock_cors)
|
427
427
|
}
|
428
|
-
|
428
|
+
|
429
429
|
it "accepts an XML string" do
|
430
430
|
subject.service_properties_from_xml service_properties_xml
|
431
431
|
end
|
432
|
-
|
432
|
+
|
433
433
|
it "returns an StorageServiceProperties instance" do
|
434
434
|
service_properties = subject.service_properties_from_xml service_properties_xml
|
435
435
|
service_properties.wont_be_nil
|
@@ -469,15 +469,15 @@ describe Azure::Service::Serialization do
|
|
469
469
|
let(:document) { Nokogiri.Slop xml_data }
|
470
470
|
let(:root_node) { document.root }
|
471
471
|
let(:non_slop_node) { Nokogiri.parse(xml_data).root }
|
472
|
-
|
472
|
+
|
473
473
|
describe "when passed a String" do
|
474
474
|
|
475
|
-
it "parses the string into a Nokogiri::XML::Element node" do
|
475
|
+
it "parses the string into a Nokogiri::XML::Element node" do
|
476
476
|
result = subject.slopify(xml_data)
|
477
477
|
result.must_be_kind_of Nokogiri::XML::Element
|
478
478
|
end
|
479
|
-
|
480
|
-
it "returns the root of the parsed Document" do
|
479
|
+
|
480
|
+
it "returns the root of the parsed Document" do
|
481
481
|
result = subject.slopify(xml_data)
|
482
482
|
result.name.must_equal root_node.name
|
483
483
|
end
|
@@ -487,18 +487,18 @@ describe Azure::Service::Serialization do
|
|
487
487
|
result.must_respond_to :method_missing
|
488
488
|
end
|
489
489
|
end
|
490
|
-
|
490
|
+
|
491
491
|
describe "when passed a Nokogiri::XML::Document" do
|
492
|
-
it "returns a Nokogiri::XML::Element node" do
|
492
|
+
it "returns a Nokogiri::XML::Element node" do
|
493
493
|
result = subject.slopify(document)
|
494
494
|
result.must_be_kind_of Nokogiri::XML::Element
|
495
495
|
end
|
496
496
|
|
497
|
-
it "returns the root of the Document" do
|
497
|
+
it "returns the root of the Document" do
|
498
498
|
result = subject.slopify(document)
|
499
499
|
result.name.must_equal root_node.name
|
500
500
|
end
|
501
|
-
|
501
|
+
|
502
502
|
it "enables Nokogiri 'Slop' mode on the returned Element" do
|
503
503
|
result = subject.slopify(xml_data)
|
504
504
|
result.must_respond_to :method_missing
|
@@ -506,7 +506,7 @@ describe Azure::Service::Serialization do
|
|
506
506
|
end
|
507
507
|
|
508
508
|
describe "when passed a Nokogiri::XML::Element" do
|
509
|
-
it "returns the Element unchanged" do
|
509
|
+
it "returns the Element unchanged" do
|
510
510
|
result = subject.slopify(root_node)
|
511
511
|
result.must_equal root_node
|
512
512
|
end
|