Merge lp:~ballogy/ubuntu-sso-client/drop-lazr into lp:ubuntu-sso-client

Proposed by Balló György on 2012-05-24
Status: Merged
Merged at revision: 963
Proposed branch: lp:~ballogy/ubuntu-sso-client/drop-lazr
Merge into: lp:ubuntu-sso-client
Diff against target: 87 lines (+0/-53)
2 files modified
ubuntu_sso/account.py (+0/-22)
ubuntu_sso/tests/test_account.py (+0/-31)
To merge this branch: bzr merge lp:~ballogy/ubuntu-sso-client/drop-lazr
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) 2012-05-24 Approve on 2012-05-28
Alejandro J. Cura (community) 2012-05-25 Approve on 2012-05-28
Review via email: mp+107153@code.launchpad.net

Commit Message

Removed the lazr.restfulclient dependency by removing TimestampedAuthorizer class.

Description of the Change

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.

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

Make sense, I've added alecu and I to take a look at this to make sure it is ok, but from a quick look I see no problems..

Alejandro J. Cura (alecu) wrote :

Looks good!
We should have done this earlier, but somehow it dropped from our radar.
Thanks a lot for finding it!

review: Approve
Manuel de la Peña (mandel) wrote :

I'm approving this too and I've added bug #1005544 and bug 1005548 to ensure we clean the code in all left places.

review: Approve
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (156.1 KiB)

The attempt to merge lp:~ballogy/ubuntu-sso-client/drop-lazr into lp:ubuntu-sso-client failed. Below is the output from the failed tests.

*** Running GTK test suite for ubuntu_sso ***
Starting squid version...
Waiting for squid to start....
Waiting for squid to start.....
ubuntu_sso.main.tests.test_common
  BaseTestCase
    runTest ... [OK]
  CredentialsManagementClearTestCase
    test_backend_called ... [OK]
    test_does_not_block ... [OK]
    test_handles_error ... [OK]
  CredentialsManagementFindTestCase
    test_backend_called ... [OK]
    test_does_not_block ... [OK]
    test_find_credentials_with_error_cb ... [OK]
    test_find_credentials_with_success_cb ... [OK]
    test_handles_error ... [OK]
  CredentialsManagementNotFindTestCase
    test_backend_called ... [OK]
    test_does_not_block ... [OK]
    test_find_credentials_with_error_cb ... [OK]
    test_find_credentials_with_success_cb ... [OK]
    test_handles_error ... [OK]
  CredentialsManagementOpsTestCase
    test_login ... [OK]
    test_login_email_password ... [OK]
    test_register ... [OK]
  CredentialsManagementParamsTestCase
    test_login ... [OK]
    test_login_email_password ... [OK]
    test_register ... [OK]
  CredentialsManagementRefCountingTestCase
    test_authorization_denied ... [OK]
    test_autorization_denied_when_ref_count_is_not_positive ... [OK]
    test_clear_credentials ... [OK]
    test_credentials_cleared ... [OK]
    test_credentials_cleared_when_ref_count_is_not_positive ... [OK]
    test_credentials_error ... [OK]
    test_credentials_error_when_ref_count_is_not_positive ... [OK]
    test_credentials_found ... [OK]
    test_credentials_found_when_ref_count_is_not_positive ... [OK]
    test_credentials_not_found ... [OK]
    test_credentials_not_found_when_ref_count_is_not_positive ... [OK]
    test_credentials_stored ... [OK]
    test_credentials_stored_when_ref_count_is_not_positive ... [OK]
    test_...

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

Subscribers

People subscribed via source and target branches