~jameinel/juju-core/api-registry-tracks-type

« back to all changes in this revision

Viewing changes to environs/azure/storage_test.go

Merged local-sudo-caller into local-provider-bootstrap.

Show diffs side-by-side

added added

removed removed

Lines of Context:
171
171
        c.Assert(err, NotNil)
172
172
}
173
173
 
 
174
var emptyBlobList = `
 
175
        <?xml version="1.0" encoding="utf-8"?>
 
176
        <EnumerationResults ContainerName="http://myaccount.blob.core.windows.net/mycontainer">
 
177
        </EnumerationResults>
 
178
        `
 
179
 
 
180
func (StorageSuite) TestRemoveAll(c *C) {
 
181
        // When we ask gwacl to remove all blobs, first thing it does is
 
182
        // list them.  If the list is empty, we're done.
 
183
        // Testing for the case where there are files is harder, but not
 
184
        // needed: the difference is internal to gwacl, and tested there.
 
185
        response := makeResponse(emptyBlobList, http.StatusOK)
 
186
        storage, transport := makeAzureStorage(response, "cntnr", "account")
 
187
 
 
188
        err := storage.RemoveAll()
 
189
        c.Assert(err, IsNil)
 
190
 
 
191
        _, err = storage.getStorageContext()
 
192
        c.Assert(err, IsNil)
 
193
        // Without going too far into gwacl's innards, this is roughly what
 
194
        // it needs to do in order to list the files.
 
195
        c.Check(transport.Request.URL.String(), Matches, "http.*/cntnr?.*restype=container.*")
 
196
        c.Check(transport.Request.Method, Equals, "GET")
 
197
}
 
198
 
174
199
func (StorageSuite) TestRemoveNonExistantBlobSucceeds(c *C) {
175
200
        container := "container"
176
201
        filename := "blobname"