test/api_stub/requests/resources/resource.rb in fog-azure-rm-0.0.4 vs test/api_stub/requests/resources/resource.rb in fog-azure-rm-0.0.5
- old
+ new
@@ -1,11 +1,11 @@
module ApiStub
module Requests
module Resources
# Mock class for Tag Requests
class AzureResource
- def self.azure_resource_response
+ def self.azure_resource_response(client)
body = '{
"id": "/subscriptions/########-####-####-####-############/resourceGroups/{RESOURCE-GROUP}/providers/Microsoft.Network/{PROVIDER-NAME}/{RESOURCE-NAME}",
"name": "your-resource-name",
"type": "providernamespace/resourcetype",
"location": "westus",
@@ -14,16 +14,15 @@
},
"plan": {
"name": "free"
}
}'
- result = MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new)
- result.body = Azure::ARM::Resources::Models::GenericResource.deserialize_object(JSON.load(body))
- result
+ result_mapper = Azure::ARM::Resources::Models::GenericResource.mapper
+ client.deserialize(result_mapper, JSON.load(body), 'result.body')
end
- def self.list_tagged_resources_response
+ def self.list_tagged_resources_response(client)
body = '{
"value": [ {
"id": "/subscriptions/########-####-####-####-############/resourceGroups/{RESOURCE-GROUP}/providers/Microsoft.Network/{PROVIDER-NAME}/{RESOURCE-NAME}",
"name": "your-resource-name",
"type": "providernamespace/resourcetype",
@@ -35,12 +34,11 @@
"name": "free"
}
} ],
"nextLink": "https://management.azure.com/subscriptions/########-####-####-####-############/resourcegroups?api-version=2015-01-01&$skiptoken=######"
}'
- result = MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new)
- result.body = Azure::ARM::Resources::Models::ResourceListResult.deserialize_object(JSON.load(body))
- result
+ result_mapper = Azure::ARM::Resources::Models::ResourceListResult.mapper
+ client.deserialize(result_mapper, JSON.load(body), 'result.body')
end
end
end
end
end