Merge lp:~brian.curtin/ubuntu-sso-client/drop-lazr-lint-fixes into lp:ubuntu-sso-client

Proposed by Brian Curtin on 2012-05-29
Status: Merged
Approved by: dobey on 2012-05-29
Approved revision: 965
Merged at revision: 963
Proposed branch: lp:~brian.curtin/ubuntu-sso-client/drop-lazr-lint-fixes
Merge into: lp:ubuntu-sso-client
Diff against target: 96 lines (+0/-55)
2 files modified
ubuntu_sso/account.py (+0/-23)
ubuntu_sso/tests/test_account.py (+0/-32)
To merge this branch: bzr merge lp:~brian.curtin/ubuntu-sso-client/drop-lazr-lint-fixes
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) 2012-05-29 Approve on 2012-05-29
Review via email: mp+107834@code.launchpad.net

Commit Message

Removed the lazr.restfulclient dependency by removing TimestampedAuthorizer class. Contributed by György Balló.

Description of the Change

From György Balló's lp:~ballogy/ubuntu-sso-client/drop-lazr branch:

This change removes lazr.restfulclient dependency by removing TimestampedAuthorizer class. It seems that TimestampedAuthorizer is not used by ubuntu-sso-client or ubuntuone-client, so I request to remove it.

I'm packaging Ubuntu One client for Arch Linux and this change makes it much easier, because I don't need to package lazr.restfulclient, lazr.uri and python-wadllib.

[This proposal includes György's changes and two additional lint fixes to ensure the branch can land.]

To post a comment you must log in.
Manuel de la Peña (mandel) wrote :

hurray we have no lint issues!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_sso/account.py'
2--- ubuntu_sso/account.py 2012-04-09 17:38:24 +0000
3+++ ubuntu_sso/account.py 2012-05-29 17:03:23 +0000
4@@ -38,8 +38,6 @@
5 import os
6 import re
7
8-from lazr.restfulclient.authorize.oauth import OAuthAuthorizer
9-from oauth import oauth
10 from twisted.internet import defer
11
12 from ubuntu_sso.logger import setup_logging
13@@ -54,27 +52,6 @@
14 SSO_STATUS_ERROR = 'error'
15
16
17-class TimestampedAuthorizer(OAuthAuthorizer):
18- """Includes a custom timestamp on OAuth signatures."""
19-
20- def __init__(self, get_timestamp, *args, **kwargs):
21- """Store the get_timestamp method, and move on."""
22- super(TimestampedAuthorizer, self).__init__(*args, **kwargs)
23- self.get_timestamp = get_timestamp
24-
25- # pylint: disable=C0103
26- def authorizeRequest(self, absolute_uri, method, body, headers):
27- """Override authorizeRequest including the timestamp."""
28- parameters = {"oauth_timestamp": self.get_timestamp()}
29- oauth_request = oauth.OAuthRequest.from_consumer_and_token(
30- self.consumer, self.access_token, http_url=absolute_uri,
31- parameters=parameters)
32- oauth_request.sign_request(
33- oauth.OAuthSignatureMethod_PLAINTEXT(),
34- self.consumer, self.access_token)
35- headers.update(oauth_request.to_header(self.oauth_realm))
36-
37-
38 class InvalidEmailError(Exception):
39 """The email is not valid."""
40
41
42=== modified file 'ubuntu_sso/tests/test_account.py'
43--- ubuntu_sso/tests/test_account.py 2012-04-09 17:38:24 +0000
44+++ ubuntu_sso/tests/test_account.py 2012-05-29 17:03:23 +0000
45@@ -34,7 +34,6 @@
46 import os
47 import urllib2
48
49-from oauth import oauth
50 from twisted.trial.unittest import TestCase
51 from twisted.internet import defer
52
53@@ -51,7 +50,6 @@
54 ResetPasswordTokenError,
55 SSO_STATUS_OK,
56 SSO_STATUS_ERROR,
57- TimestampedAuthorizer,
58 )
59 from ubuntu_sso.tests import (
60 APP_NAME,
61@@ -203,36 +201,6 @@
62 return defer.fail(e)
63
64
65-class TimestampedAuthorizerTestCase(TestCase):
66- """Test suite for the TimestampedAuthorizer."""
67-
68- def test_authorize_request_includes_timestamp(self):
69- """The authorizeRequest method includes the timestamp."""
70- fromcandt_call = []
71- fake_uri = "http://protocultura.net"
72- fake_timestamp = 1234
73- get_fake_timestamp = lambda: fake_timestamp
74- original_oauthrequest = oauth.OAuthRequest
75-
76- class FakeOAuthRequest(oauth.OAuthRequest):
77- """A Fake OAuthRequest class."""
78-
79- @staticmethod
80- def from_consumer_and_token(*args, **kwargs):
81- """A fake from_consumer_and_token."""
82- fromcandt_call.append((args, kwargs))
83- builder = original_oauthrequest.from_consumer_and_token
84- return builder(*args, **kwargs)
85-
86- self.patch(oauth, "OAuthRequest", FakeOAuthRequest)
87-
88- authorizer = TimestampedAuthorizer(get_fake_timestamp, "ubuntuone")
89- authorizer.authorizeRequest(fake_uri, "POST", None, {})
90- call_kwargs = fromcandt_call[0][1]
91- parameters = call_kwargs["parameters"]
92- self.assertEqual(parameters["oauth_timestamp"], fake_timestamp)
93-
94-
95 class AccountTestCase(TestCase):
96 """Test suite for the SSO login processor."""
97

Subscribers

People subscribed via source and target branches