// makeAzureStorage creates a test azureStorage object that will talk to a // fake http server set up to always return the given http.Response object. // makeAzureStorage returns an azureStorage object and a TestTransport object. // The TestTransport object can be used to check that the expected query has // been issued to the test server. func makeAzureStorage(response *http.Response, container string, account string) (azureStorage, *TestTransport) { transport := &TestTransport{Response: response} client := &http.Client{Transport: transport} storageContext := gwacl.NewTestStorageContext(client) storageContext.Account = account context := &testStorageContext{container: container, storageContext: storageContext} azStorage := azureStorage{context} return azStorage, transport }
// makeFakeStorage creates a test azureStorage object that will talk to a // fake HTTP server set up to always return preconfigured http.Response objects. // The MockingTransport object can be used to check that the expected query has // been issued to the test server. func makeFakeStorage(container, account string) (azureStorage, *MockingTransport) { transport := &MockingTransport{} client := &http.Client{Transport: transport} storageContext := gwacl.NewTestStorageContext(client) storageContext.Account = account context := &testStorageContext{container: container, storageContext: storageContext} azStorage := azureStorage{storageContext: context} return azStorage, transport }