Skip to content

Commit f3733a5

Browse files
author
Michael Nelson
committed
Merge master
2 parents e4a90f8 + 2b94bd4 commit f3733a5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

environs/azure/storage_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ func makeFakeStorage(container, account string) (azureStorage, *MockingTransport
9191
return azStorage, transport
9292
}
9393

94+
// setStorageEndpoint sets a given Azure API endpoint on a given azureStorage.
95+
func setStorageEndpoint(azStorage *azureStorage, endpoint gwacl.APIEndpoint) {
96+
// Ugly, because of the confusingly similar layers of nesting.
97+
testContext := azStorage.storageContext.(*testStorageContext)
98+
var gwaclContext *gwacl.StorageContext = testContext.storageContext
99+
gwaclContext.AzureEndpoint = endpoint
100+
}
101+
94102
var blobListResponse = `
95103
<?xml version="1.0" encoding="utf-8"?>
96104
<EnumerationResults ContainerName="http://myaccount.blob.core.windows.net/mycontainer">
@@ -253,6 +261,9 @@ func (*storageSuite) TestURL(c *C) {
253261
filename := "blobname"
254262
account := "account"
255263
azStorage, _ := makeFakeStorage(container, account)
264+
// Use a realistic service endpoint for this test, so that we can see
265+
// that we're really getting the expected kind of URL.
266+
setStorageEndpoint(&azStorage, gwacl.GetEndpoint("West US"))
256267
URL, err := azStorage.URL(filename)
257268
c.Assert(err, IsNil)
258269
parsedURL, err := url.Parse(URL)

0 commit comments

Comments
 (0)