From 9c2fc7e28901c043ce06d9b2c0b3512993a61267 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Thu, 25 May 2017 13:25:14 +0100 Subject: Fix generate_url() AttributeError when using anonymous connections Previously generating a URL would fail for anonymous connections (even when using `query_auth=False`), with: `AttributeError: 'AnonAuthHandler' object has no attribute '_hmac_256'` That now works, and in addition the `query_auth=False` parameter is now optional for anonymous connections. Fixes #1540. --- tests/unit/s3/test_connection.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/unit/s3/test_connection.py b/tests/unit/s3/test_connection.py index 5304cf5e..b382605d 100644 --- a/tests/unit/s3/test_connection.py +++ b/tests/unit/s3/test_connection.py @@ -48,6 +48,18 @@ class TestSignatureAlteration(AWSMockServiceTestCase): ) +class TestAnon(MockServiceWithConfigTestCase): + connection_class = S3Connection + + def test_generate_url(self): + conn = self.connection_class( + anon=True, + host='s3.amazonaws.com' + ) + url = conn.generate_url(0, 'GET', bucket='examplebucket', key='test.txt') + self.assertNotIn('Signature=', url) + + class TestPresigned(MockServiceWithConfigTestCase): connection_class = S3Connection -- cgit v1.2.1