Merge lp:~newell-jensen/maas/wrong-apikey into lp:~maas-committers/maas/trunk

Proposed by Newell Jensen
Status: Merged
Approved by: Newell Jensen
Approved revision: no longer in the source branch.
Merged at revision: 2637
Proposed branch: lp:~newell-jensen/maas/wrong-apikey
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 23 lines (+4/-1)
2 files modified
src/maasserver/api_auth.py (+1/-0)
src/maasserver/tests/test_api_auth.py (+3/-1)
To merge this branch: bzr merge lp:~newell-jensen/maas/wrong-apikey
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Blake Rouse (community) Approve
Review via email: mp+229031@code.launchpad.net

Commit message

Adding additional use information for invalid apikey (Authorization Error)

Description of the change

Adding additional user information for invalid apikey (Authorization Error)

To post a comment you must log in.
Revision history for this message
Blake Rouse (blake-rouse) wrote :

Looks good. The test is already checking that the error is raised in the unittest, nice.

review: Approve
Revision history for this message
Julian Edwards (julian-edwards) wrote :

Test for the error needed!

Revision history for this message
Newell Jensen (newell-jensen) wrote :

> Test for the error needed!

Added and tested.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

Well sleuthed!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/api_auth.py'
2--- src/maasserver/api_auth.py 2014-01-17 11:56:22 +0000
3+++ src/maasserver/api_auth.py 2014-07-31 14:12:50 +0000
4@@ -31,6 +31,7 @@
5 def __init__(self, error):
6 super(OAuthUnauthorized, self).__init__()
7 self.error = error
8+ self.error.message = "Authorization Error: %r" % error.message
9
10 def make_http_response(self):
11 return send_oauth_error(self.error)
12
13=== modified file 'src/maasserver/tests/test_api_auth.py'
14--- src/maasserver/tests/test_api_auth.py 2014-01-17 11:56:22 +0000
15+++ src/maasserver/tests/test_api_auth.py 2014-07-31 14:12:50 +0000
16@@ -27,4 +27,6 @@
17 error_msg = factory.make_name('error-message')
18 original_exception = oauth.OAuthError(error_msg)
19 maas_exception = api_auth.OAuthUnauthorized(original_exception)
20- self.assertThat(unicode(maas_exception), Contains(error_msg))
21+ self.assertThat(
22+ unicode(maas_exception),
23+ Contains("Authorization Error: %r" % error_msg))