def testCreatesExpectedStringForObjectDeleteWithDateAlternative(self): headers = { "Date": "Tue, 27 Mar 2007 21:15:45 +0000", "x-amz-date": "Tue, 27 Mar 2007 21:20:26 +0000" } params = Parameters("DELETE", "johnsmith", "puppy.jpg", headers) expected = "DELETE\n\n\n\nx-amz-date:Tue, 27 Mar 2007 21:20:26 +0000\n/johnsmith/puppy.jpg" self.assertEqual(expected, params.textToSign())
def testCreatesExpectedStringForObjectPut(self): headers = { "Date": "Tue, 27 Mar 2007 21:15:45 +0000", "Content-MD5": "4gJE4saaMU4BqNR0kLY+lw==", "Content-Type": "image/jpeg", "Content-Length": "94328" } params = Parameters('PUT', 'johnsmith', 'puppy.jpg', headers) expected = "PUT\n4gJE4saaMU4BqNR0kLY+lw==\nimage/jpeg\nTue, 27 Mar 2007 21:15:45 +0000\n/johnsmith/puppy.jpg" self.assertEqual(expected, params.textToSign())
def testCreatesExpectedStringForObjectGetWithExpiryTimestamp(self): headers = {"Date": "Tue, 27 Mar 2007 19:36:42 +0000"} params = Parameters("GET", "johnsmith", "puppy.jpg", headers, None, 1211233765000) expected = "GET\n\n\n1211233765000\n/johnsmith/puppy.jpg" self.assertEqual(expected, params.textToSign())
def testCreatesExpectedStringForAclFetch(self): headers = {"Date": "Tue, 27 Mar 2007 19:36:42 +0000"} params = Parameters('GET', 'johnsmith', None, headers, 'acl') expected = "GET\n\n\nTue, 27 Mar 2007 19:36:42 +0000\n/johnsmith/?acl" self.assertEqual(expected, params.textToSign())
def testCreatesExpectedStringForObjectGetWithPath(self): headers = {"Date": "Tue, 27 Mar 2007 19:36:42 +0000"} params = Parameters('GET', 'johnsmith', 'cute/puppy.jpg', headers) expected = "GET\n\n\nTue, 27 Mar 2007 19:36:42 +0000\n/johnsmith/cute/puppy.jpg" self.assertEqual(expected, params.textToSign())