~axwalk/juju-core/trunk

« back to all changes in this revision

Viewing changes to environs/azure/storage_test.go

  • Committer: Tarmac
  • Author(s): Julian Edwards
  • Date: 2013-07-30 09:30:57 UTC
  • mfrom: (1544.3.12 create-container)
  • Revision ID: tarmac-20130730093057-kpimrc7xku90yst7
[r=julian-edwards] The Azure provider now creates/destroys its own storage containers, removing the need to configure one.

Show diffs side-by-side

added added

removed removed

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