Merge lp:~dobey/ubuntu-sso-client/testable-env into lp:ubuntu-sso-client

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 1027
Merged at revision: 1026
Proposed branch: lp:~dobey/ubuntu-sso-client/testable-env
Merge into: lp:ubuntu-sso-client
Diff against target: 141 lines (+20/-16)
5 files modified
ubuntu_sso/__init__.py (+8/-2)
ubuntu_sso/account.py (+3/-5)
ubuntu_sso/qt/sso_wizard_page.py (+5/-5)
ubuntu_sso/utils/webclient/qtnetwork.py (+1/-2)
ubuntu_sso/utils/webclient/timestamp.py (+3/-2)
To merge this branch: bzr merge lp:~dobey/ubuntu-sso-client/testable-env
Reviewer Review Type Date Requested Status
Brian Curtin (community) Approve
Mike McCracken (community) Approve
Review via email: mp+156080@code.launchpad.net

Commit message

Unify usage of login and u1 host into environment variables, for testing.

Description of the change

This replaces usage of login.ubuntu.com in URLs with the value of $SSO_AUTH_HOST which defaults to login.ubuntu.com, and usage of one.ubuntu.com with value of $SSO_UONE_HOST which defaults to one.ubuntu.com.

To post a comment you must log in.
1027. By dobey

Update copyright years too.

Revision history for this message
Mike McCracken (mikemc) wrote :

tests pass on osx and linux, verified that the env vars do appear to work for me.

review: Approve
Revision history for this message
Brian Curtin (brian.curtin) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_sso/__init__.py'
2--- ubuntu_sso/__init__.py 2012-07-14 04:59:06 +0000
3+++ ubuntu_sso/__init__.py 2013-03-28 21:52:22 +0000
4@@ -1,6 +1,5 @@
5-# ubuntu_sso - Ubuntu Single Sign On client support for desktop apps
6 #
7-# Copyright 2009-2012 Canonical Ltd.
8+# Copyright 2009-2013 Canonical Ltd.
9 #
10 # This program is free software: you can redistribute it and/or modify it
11 # under the terms of the GNU General Public License version 3, as published
12@@ -28,6 +27,13 @@
13 # files in the program, then also delete it here.
14 """Ubuntu Single Sign On client code."""
15
16+import os
17+
18+
19+# Host URL changing environment variables
20+SSO_AUTH_HOST = os.environ.get('SSO_AUTH_HOST', 'login.ubuntu.com')
21+SSO_UONE_HOST = os.environ.get('SSO_UONE_HOST', 'one.ubuntu.com')
22+
23 # DBus constants
24 DBUS_BUS_NAME = "com.ubuntu.sso"
25
26
27=== modified file 'ubuntu_sso/account.py'
28--- ubuntu_sso/account.py 2012-06-29 22:40:07 +0000
29+++ ubuntu_sso/account.py 2013-03-28 21:52:22 +0000
30@@ -1,9 +1,6 @@
31 # -*- coding: utf-8 -*-
32-
33-# Author: Natalia Bidart <natalia.bidart@canonical.com>
34-# Author: Alejandro J. Cura <alecu@canonical.com>
35 #
36-# Copyright 2010-2012 Canonical Ltd.
37+# Copyright 2010-2013 Canonical Ltd.
38 #
39 # This program is free software: you can redistribute it and/or modify it
40 # under the terms of the GNU General Public License version 3, as published
41@@ -42,6 +39,7 @@
42
43 from twisted.internet import defer
44
45+from ubuntu_sso import SSO_AUTH_HOST
46 from ubuntu_sso.logger import setup_logging
47 from ubuntu_sso.utils import compat, webclient
48 from ubuntu_sso.utils.webclient import restful
49@@ -49,7 +47,7 @@
50
51
52 logger = setup_logging("ubuntu_sso.account")
53-SERVICE_URL = "https://login.ubuntu.com/api/1.0/"
54+SERVICE_URL = "https://%s/api/1.0/" % SSO_AUTH_HOST
55 SSO_STATUS_OK = 'ok'
56 SSO_STATUS_ERROR = 'error'
57
58
59=== modified file 'ubuntu_sso/qt/sso_wizard_page.py'
60--- ubuntu_sso/qt/sso_wizard_page.py 2013-03-21 17:47:33 +0000
61+++ ubuntu_sso/qt/sso_wizard_page.py 2013-03-28 21:52:22 +0000
62@@ -1,6 +1,6 @@
63 # -*- coding: utf-8 -*-
64 #
65-# Copyright 2011-2012 Canonical Ltd.
66+# Copyright 2011-2013 Canonical Ltd.
67 #
68 # This program is free software: you can redistribute it and/or modify it
69 # under the terms of the GNU General Public License version 3, as published
70@@ -47,7 +47,7 @@
71 )
72 from twisted.internet import defer
73
74-from ubuntu_sso import constants, main
75+from ubuntu_sso import constants, main, SSO_UONE_HOST
76 from ubuntu_sso.logger import setup_gui_logging, log_call
77 from ubuntu_sso.qt import (
78 ERROR_STYLE,
79@@ -72,10 +72,10 @@
80
81
82 APP_NAME = u"Ubuntu One"
83-TC_URL = u"https://one.ubuntu.com/terms/"
84-POLICY_URL = u"https://one.ubuntu.com/privacy/"
85+TC_URL = u"https://%s/terms/" % SSO_UONE_HOST
86+POLICY_URL = u"https://%s/privacy/" % SSO_UONE_HOST
87 BASE_PING_URL = \
88- u"https://one.ubuntu.com/oauth/sso-finished-so-get-tokens/{email}"
89+ u"https://%s/oauth/sso-finished-so-get-tokens/{email}" % SSO_UONE_HOST
90 # the result of platform_data is given by urlencode, encoded with ascii
91 PING_URL = BASE_PING_URL + u"?" + platform_data().decode('ascii')
92
93
94=== modified file 'ubuntu_sso/utils/webclient/qtnetwork.py'
95--- ubuntu_sso/utils/webclient/qtnetwork.py 2012-12-14 22:06:47 +0000
96+++ ubuntu_sso/utils/webclient/qtnetwork.py 2013-03-28 21:52:22 +0000
97@@ -1,6 +1,6 @@
98 # -*- coding: utf-8 -*-
99 #
100-# Copyright 2011-2012 Canonical Ltd.
101+# Copyright 2011-2013 Canonical Ltd.
102 #
103 # This program is free software: you can redistribute it and/or modify it
104 # under the terms of the GNU General Public License version 3, as published
105@@ -62,7 +62,6 @@
106 from ubuntu_sso.utils.webclient import gsettings
107
108 logger = setup_logging("ubuntu_sso.utils.webclient.qtnetwork")
109-PROXY_REQUEST = 'https://one.ubuntu.com'
110
111
112 def build_proxy(settings_groups):
113
114=== modified file 'ubuntu_sso/utils/webclient/timestamp.py'
115--- ubuntu_sso/utils/webclient/timestamp.py 2012-06-22 16:12:03 +0000
116+++ ubuntu_sso/utils/webclient/timestamp.py 2013-03-28 21:52:22 +0000
117@@ -1,6 +1,6 @@
118 # -*- coding: utf-8 -*-
119 #
120-# Copyright 2011-2012 Canonical Ltd.
121+# Copyright 2011-2013 Canonical Ltd.
122 #
123 # This program is free software: you can redistribute it and/or modify it
124 # under the terms of the GNU General Public License version 3, as published
125@@ -32,6 +32,7 @@
126
127 from twisted.internet import defer
128
129+from ubuntu_sso import SSO_UONE_HOST
130 from ubuntu_sso.logger import setup_logging
131
132 logger = setup_logging("ubuntu_sso.utils.webclient.timestamp")
133@@ -43,7 +44,7 @@
134
135 CHECKING_INTERVAL = 60 * 60 # in seconds
136 ERROR_INTERVAL = 30 # in seconds
137- SERVER_IRI = u"http://one.ubuntu.com/api/time"
138+ SERVER_IRI = u"http://%s/api/time" % SSO_UONE_HOST
139
140 def __init__(self, webclient_class):
141 """Initialize this instance."""

Subscribers

People subscribed via source and target branches