Fix PUTs.

This commit is contained in:
Itamar Turner-Trauring 2013-03-21 14:40:27 -04:00 committed by Daira Hopwood
parent b3bd6a1279
commit e3fdc479c9
2 changed files with 7 additions and 4 deletions

View File

@ -178,6 +178,7 @@ class MSAzureStorageContainer(CommonContainerMixin):
# correctly: # correctly:
request_headers = {'Content-Length': ["%d" % (len(data),)], request_headers = {'Content-Length': ["%d" % (len(data),)],
'Content-Type': [content_type], 'Content-Type': [content_type],
"x-ms-blob-type": ["BlockBlob"],
} }
for key, value in metadata.items(): for key, value in metadata.items():
request_headers["x-ms-meta-%s" % (key,)] = [value] request_headers["x-ms-meta-%s" % (key,)] = [value]
@ -232,18 +233,18 @@ if __name__ == '__main__':
@defer.inlineCallbacks @defer.inlineCallbacks
def testtransactions(): def testtransactions():
yield msc.put_object("key", "the value") yield msc.put_object("key", "the value")
print "Uploaded key:'the value'" print "Uploaded 'key', with value 'the value'"
print print
print "Get contents:" print "Get contents:",
result = yield msc.list_objects() result = yield msc.list_objects()
print [item.key for item in result.contents] print [item.key for item in result.contents]
print "Get key, value is:" print "Get key, value is:"
print (yield msc.get_object("key")) print (yield msc.get_object("key"))
print print
print "Delete item:" print "Delete item..."
yield msc.delete_object("key") yield msc.delete_object("key")
print print
print "Get contents:" print "Get contents:",
result = yield msc.list_objects() result = yield msc.list_objects()
print [item.key for item in result.contents] print [item.key for item in result.contents]
reactor.stop() reactor.stop()

View File

@ -1332,6 +1332,7 @@ class MSAzureStorageBackendTests(unittest.TestCase, CloudStorageBackendMixin):
"Content-Type": ["application/octet-stream"], "Content-Type": ["application/octet-stream"],
"Content-Length": [str(len("the body"))], "Content-Length": [str(len("the body"))],
"x-ms-date": [self.date], "x-ms-date": [self.date],
"x-ms-blob-type": ["BlockBlob"],
}, },
body="the body", body="the body",
need_response_body=False) need_response_body=False)
@ -1361,6 +1362,7 @@ class MSAzureStorageBackendTests(unittest.TestCase, CloudStorageBackendMixin):
"Content-Length": [str(len("the body"))], "Content-Length": [str(len("the body"))],
"x-ms-meta-key": ["value"], "x-ms-meta-key": ["value"],
"x-ms-date": [self.date], "x-ms-date": [self.date],
"x-ms-blob-type": ["BlockBlob"],
}, },
body="the body", body="the body",
need_response_body=False) need_response_body=False)