Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Fix generate_url() AttributeError when using anonymous connections #3734

Merged
merged 1 commit into from
Jun 28, 2017
Merged

Fix generate_url() AttributeError when using anonymous connections #3734

merged 1 commit into from
Jun 28, 2017

Conversation

edmorley
Copy link
Contributor

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.

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.
@edmorley
Copy link
Contributor Author

@mfschwartz - I don't suppose you'd mind reviewing this? :-)


def test_generate_url(self):
conn = self.connection_class(
anon=True,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there another test for that exercises that the non-anonymous case generates a URL as expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the existing tests here (since anon defaults to False):

url_enabled = conn.generate_url(86400, 'GET', bucket='examplebucket',
key='test.txt', query_auth=True)
url_disabled = conn.generate_url(86400, 'GET', bucket='examplebucket',
key='test.txt', query_auth=False)
self.assertIn('Signature=', url_enabled)
self.assertNotIn('Signature=', url_disabled)

url_enabled = conn.generate_url(86400, 'GET', bucket='examplebucket',
key='test.txt', query_auth=True)
url_disabled = conn.generate_url(86400, 'GET', bucket='examplebucket',
key='test.txt', query_auth=False)
self.assertIn('Signature=', url_enabled)
self.assertNotIn('Signature=', url_disabled)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks. LGTM.

@mfschwartz mfschwartz merged commit 8348180 into boto:develop Jun 28, 2017
@edmorley edmorley deleted the anon-generate_url branch June 28, 2017 18:09
@edmorley
Copy link
Contributor Author

Many thanks! 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants