Merge lp:~elopio/ubuntuone-testing/configglue into lp:ubuntuone-testing
- configglue
- Merge into trunk
Proposed by
Leo Arias
Status: | Merged |
---|---|
Approved by: | Leo Arias |
Approved revision: | 127 |
Merged at revision: | 117 |
Proposed branch: | lp:~elopio/ubuntuone-testing/configglue |
Merge into: | lp:ubuntuone-testing |
Diff against target: |
719 lines (+296/-136) 19 files modified
.bzrignore (+1/-6) ubuntuone/web/tests/sst/account/u1weba001_accountdetails.py (+3/-7) ubuntuone/web/tests/sst/account/u1weba8_createaccount.py (+26/-0) ubuntuone/web/tests/sst/payments/u1webp001_paymusicstreaming.py (+3/-3) ubuntuone/web/tests/sst/payments/u1webp002_payadditionalstorage.py (+1/-2) ubuntuone/web/tests/sst/payments/u1webp003_paywithrefusedcard.py (+3/-3) ubuntuone/web/tests/sst/session/u1webs10_login.py (+4/-9) ubuntuone/web/tests/sst/shared/actions/dashboard.py (+8/-2) ubuntuone/web/tests/sst/shared/actions/files.py (+2/-8) ubuntuone/web/tests/sst/shared/actions/setup.py (+48/-44) ubuntuone/web/tests/sst/shared/config.py (+0/-38) ubuntuone/web/tests/sst/shared/config/environment.py (+49/-0) ubuntuone/web/tests/sst/shared/config/sample.cfg (+25/-0) ubuntuone/web/tests/sst/shared/config/schema.py (+61/-0) ubuntuone/web/tests/sst/shared/data/environment.py (+44/-0) ubuntuone/web/tests/sst/shared/edge_config.py (+0/-2) ubuntuone/web/tests/sst/shared/prod_config.py (+0/-2) ubuntuone/web/tests/sst/shared/stag_config.py (+0/-2) ubuntuone/web/tests/sst/shared/utils/mail.py (+18/-8) |
To merge this branch: | bzr merge lp:~elopio/ubuntuone-testing/configglue |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Corey Goldberg (community) | Approve | ||
Vincent Ladeuil (community) | Approve | ||
Review via email:
|
This proposal supersedes a proposal from 2012-08-08.
Commit message
Added configglue configuration.
Description of the change
Added configglue configuration.
Updated and added tests to try the config files.
Test this branch with:
sst-run -d /path/to/
sst-run -d /path/to/
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Vincent Ladeuil (vila) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.bzrignore' | |||
2 | --- .bzrignore 2012-06-19 20:26:48 +0000 | |||
3 | +++ .bzrignore 2012-08-10 00:06:19 +0000 | |||
4 | @@ -6,12 +6,7 @@ | |||
5 | 6 | *.pyc | 6 | *.pyc |
6 | 7 | ubuntuone_testing_log | 7 | ubuntuone_testing_log |
7 | 8 | testdata/*.file | 8 | testdata/*.file |
8 | 9 | passwords.py | ||
9 | 10 | reports/* | 9 | reports/* |
10 | 11 | _passwords.py | ||
11 | 12 | _musicpasswords.py | ||
12 | 13 | _localconfig.py | ||
13 | 14 | sourcecode | 10 | sourcecode |
14 | 15 | results | 11 | results |
17 | 16 | _devserver.py | 12 | local.cfg |
16 | 17 | _photopasswords.py | ||
18 | 18 | \ No newline at end of file | 13 | \ No newline at end of file |
19 | 19 | 14 | ||
20 | === modified file 'ubuntuone/web/tests/sst/account/u1weba001_accountdetails.py' | |||
21 | --- ubuntuone/web/tests/sst/account/u1weba001_accountdetails.py 2012-06-26 16:39:03 +0000 | |||
22 | +++ ubuntuone/web/tests/sst/account/u1weba001_accountdetails.py 2012-08-10 00:06:19 +0000 | |||
23 | @@ -23,15 +23,11 @@ | |||
24 | 23 | import actions.setup as setup_actions | 23 | import actions.setup as setup_actions |
25 | 24 | import actions.account as account_actions | 24 | import actions.account as account_actions |
26 | 25 | from _passwords import full_name, email | 25 | from _passwords import full_name, email |
28 | 26 | from config import ENVIRONMENT | 26 | from config import environment |
29 | 27 | 27 | ||
30 | 28 | setup_actions.setup() | 28 | setup_actions.setup() |
31 | 29 | account_actions.open() | 29 | account_actions.open() |
32 | 30 | account_actions.assert_account_details(full_name, email) | 30 | account_actions.assert_account_details(full_name, email) |
33 | 31 | account_actions.click_edit_account_details() | 31 | account_actions.click_edit_account_details() |
40 | 32 | url = None | 32 | sso_url = environment.get_environment().sso_url |
41 | 33 | if ENVIRONMENT == 'staging': | 33 | assert_url(sso_url) |
36 | 34 | url = 'https://login.staging.ubuntu.com/' | ||
37 | 35 | else: | ||
38 | 36 | url = 'https://login.ubuntu.com/' | ||
39 | 37 | assert_url(url) | ||
42 | 38 | 34 | ||
43 | === added file 'ubuntuone/web/tests/sst/account/u1weba8_createaccount.py' | |||
44 | --- ubuntuone/web/tests/sst/account/u1weba8_createaccount.py 1970-01-01 00:00:00 +0000 | |||
45 | +++ ubuntuone/web/tests/sst/account/u1weba8_createaccount.py 2012-08-10 00:06:19 +0000 | |||
46 | @@ -0,0 +1,26 @@ | |||
47 | 1 | # -*- coding: utf-8 -*- | ||
48 | 2 | |||
49 | 3 | # Copyright 2012 Canonical Ltd. | ||
50 | 4 | # | ||
51 | 5 | # This program is free software: you can redistribute it and/or modify it | ||
52 | 6 | # under the terms of the GNU General Public License version 3, as published | ||
53 | 7 | # by the Free Software Foundation. | ||
54 | 8 | # | ||
55 | 9 | # This program is distributed in the hope that it will be useful, but | ||
56 | 10 | # WITHOUT ANY WARRANTY; without even the implied warranties of | ||
57 | 11 | # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
58 | 12 | # PURPOSE. See the GNU General Public License for more details. | ||
59 | 13 | # | ||
60 | 14 | # You should have received a copy of the GNU General Public License along | ||
61 | 15 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
62 | 16 | |||
63 | 17 | from sst.actions import * | ||
64 | 18 | import actions.setup as setup_actions | ||
65 | 19 | import actions.dashboard as dashboard_actions | ||
66 | 20 | import actions.header as header_actions | ||
67 | 21 | |||
68 | 22 | setup_actions.setup(new_user=True) | ||
69 | 23 | user = setup_actions.get_user() | ||
70 | 24 | dashboard_actions.assert_page_title() | ||
71 | 25 | header_actions.assert_login(user.full_name) | ||
72 | 26 | dashboard_actions.assert_welcome_message(user.full_name) | ||
73 | 0 | 27 | ||
74 | === modified file 'ubuntuone/web/tests/sst/payments/u1webp001_paymusicstreaming.py' | |||
75 | --- ubuntuone/web/tests/sst/payments/u1webp001_paymusicstreaming.py 2012-06-25 13:59:33 +0000 | |||
76 | +++ ubuntuone/web/tests/sst/payments/u1webp001_paymusicstreaming.py 2012-08-10 00:06:19 +0000 | |||
77 | @@ -21,7 +21,7 @@ | |||
78 | 21 | """Pay for the music streaming service.""" | 21 | """Pay for the music streaming service.""" |
79 | 22 | 22 | ||
80 | 23 | from sst.actions import * | 23 | from sst.actions import * |
82 | 24 | from config import ENVIRONMENT | 24 | from config import environment |
83 | 25 | from datetime import date | 25 | from datetime import date |
84 | 26 | import actions.setup as setup_actions | 26 | import actions.setup as setup_actions |
85 | 27 | import actions.services as services_actions | 27 | import actions.services as services_actions |
86 | @@ -29,8 +29,8 @@ | |||
87 | 29 | import actions.payment_confirmed as payment_confirmed_actions | 29 | import actions.payment_confirmed as payment_confirmed_actions |
88 | 30 | 30 | ||
89 | 31 | skip('This test must be updated for Ubuntu Pay.') | 31 | skip('This test must be updated for Ubuntu Pay.') |
92 | 32 | if ENVIRONMENT == 'production': | 32 | if not environment.can_make_payments(): |
93 | 33 | skip('Can\'t test payments on production.') | 33 | skip('Can\'t test payments on this environment.') |
94 | 34 | setup_actions.setup(new_user=True) | 34 | setup_actions.setup(new_user=True) |
95 | 35 | services_actions.open() | 35 | services_actions.open() |
96 | 36 | services_actions.buy_music_streaming_yearly() | 36 | services_actions.buy_music_streaming_yearly() |
97 | 37 | 37 | ||
98 | === modified file 'ubuntuone/web/tests/sst/payments/u1webp002_payadditionalstorage.py' | |||
99 | --- ubuntuone/web/tests/sst/payments/u1webp002_payadditionalstorage.py 2012-06-25 13:59:33 +0000 | |||
100 | +++ ubuntuone/web/tests/sst/payments/u1webp002_payadditionalstorage.py 2012-08-10 00:06:19 +0000 | |||
101 | @@ -1,5 +1,4 @@ | |||
102 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
103 | 2 | |||
104 | 3 | # Authors: | 2 | # Authors: |
105 | 4 | # Rick McBride <rick.mcbride@canonical.com> | 3 | # Rick McBride <rick.mcbride@canonical.com> |
106 | 5 | # Leo Arias <leo.arias@canonical.com> | 4 | # Leo Arias <leo.arias@canonical.com> |
107 | @@ -21,7 +20,7 @@ | |||
108 | 21 | """Pay for the additional sotrage service.""" | 20 | """Pay for the additional sotrage service.""" |
109 | 22 | 21 | ||
110 | 23 | from sst.actions import * | 22 | from sst.actions import * |
112 | 24 | from config import ENVIRONMENT | 23 | from config import environment |
113 | 25 | import actions.setup as setup_actions | 24 | import actions.setup as setup_actions |
114 | 26 | import actions.services as services_actions | 25 | import actions.services as services_actions |
115 | 27 | import actions.payment as payment_actions | 26 | import actions.payment as payment_actions |
116 | 28 | 27 | ||
117 | === modified file 'ubuntuone/web/tests/sst/payments/u1webp003_paywithrefusedcard.py' | |||
118 | --- ubuntuone/web/tests/sst/payments/u1webp003_paywithrefusedcard.py 2012-06-25 13:59:33 +0000 | |||
119 | +++ ubuntuone/web/tests/sst/payments/u1webp003_paywithrefusedcard.py 2012-08-10 00:06:19 +0000 | |||
120 | @@ -21,15 +21,15 @@ | |||
121 | 21 | """Pay for a service with a refused card.""" | 21 | """Pay for a service with a refused card.""" |
122 | 22 | 22 | ||
123 | 23 | from sst.actions import * | 23 | from sst.actions import * |
125 | 24 | from config import ENVIRONMENT | 24 | from config import environment |
126 | 25 | import actions.setup as setup_actions | 25 | import actions.setup as setup_actions |
127 | 26 | import actions.services as services_actions | 26 | import actions.services as services_actions |
128 | 27 | import actions.payment as payment_actions | 27 | import actions.payment as payment_actions |
129 | 28 | import actions.payment_confirmed as payment_confirmed_actions | 28 | import actions.payment_confirmed as payment_confirmed_actions |
130 | 29 | 29 | ||
131 | 30 | skip('This test must be updated for Ubuntu Pay.') | 30 | skip('This test must be updated for Ubuntu Pay.') |
134 | 31 | if ENVIRONMENT == 'production': | 31 | if not environment.can_make_payments(): |
135 | 32 | skip('Can\'t test payments on production.') | 32 | skip('Can\'t test payments on this environment.') |
136 | 33 | setup_actions.setup() | 33 | setup_actions.setup() |
137 | 34 | services_actions.open() | 34 | services_actions.open() |
138 | 35 | services_actions.buy_music_streaming() | 35 | services_actions.buy_music_streaming() |
139 | 36 | 36 | ||
140 | === renamed file 'ubuntuone/web/tests/sst/session/u1webs002_login.py' => 'ubuntuone/web/tests/sst/session/u1webs10_login.py' | |||
141 | --- ubuntuone/web/tests/sst/session/u1webs002_login.py 2012-03-27 19:04:46 +0000 | |||
142 | +++ ubuntuone/web/tests/sst/session/u1webs10_login.py 2012-08-10 00:06:19 +0000 | |||
143 | @@ -1,6 +1,6 @@ | |||
144 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
145 | 2 | 2 | ||
147 | 3 | # Copyright 2011 Canonical Ltd. | 3 | # Copyright 2011, 2012 Canonical Ltd. |
148 | 4 | # | 4 | # |
149 | 5 | # This program is free software: you can redistribute it and/or modify it | 5 | # This program is free software: you can redistribute it and/or modify it |
150 | 6 | # under the terms of the GNU General Public License version 3, as published | 6 | # under the terms of the GNU General Public License version 3, as published |
151 | @@ -14,18 +14,13 @@ | |||
152 | 14 | # You should have received a copy of the GNU General Public License along | 14 | # You should have received a copy of the GNU General Public License along |
153 | 15 | # with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | # with this program. If not, see <http://www.gnu.org/licenses/>. |
154 | 16 | 16 | ||
155 | 17 | """Test case u1webs-002 Log in. | ||
156 | 18 | Log in to the website with an existing account. | ||
157 | 19 | |||
158 | 20 | """ | ||
159 | 21 | |||
160 | 22 | from sst.actions import * | 17 | from sst.actions import * |
161 | 23 | import actions.setup as setup_actions | 18 | import actions.setup as setup_actions |
162 | 24 | import actions.dashboard as dashboard_actions | 19 | import actions.dashboard as dashboard_actions |
163 | 25 | import actions.header as header_actions | 20 | import actions.header as header_actions |
164 | 26 | from _passwords import full_name | ||
165 | 27 | 21 | ||
166 | 28 | setup_actions.setup(new_user=False) | 22 | setup_actions.setup(new_user=False) |
167 | 23 | user = setup_actions.get_user() | ||
168 | 29 | dashboard_actions.assert_page_title() | 24 | dashboard_actions.assert_page_title() |
171 | 30 | header_actions.assert_login(full_name) | 25 | header_actions.assert_login(user.full_name) |
172 | 31 | dashboard_actions.assert_welcome_message(full_name) | 26 | dashboard_actions.assert_welcome_message(user.full_name) |
173 | 32 | 27 | ||
174 | === modified file 'ubuntuone/web/tests/sst/shared/actions/dashboard.py' | |||
175 | --- ubuntuone/web/tests/sst/shared/actions/dashboard.py 2012-02-02 01:23:26 +0000 | |||
176 | +++ ubuntuone/web/tests/sst/shared/actions/dashboard.py 2012-08-10 00:06:19 +0000 | |||
177 | @@ -1,6 +1,6 @@ | |||
178 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
179 | 2 | 2 | ||
181 | 3 | # Copyright 2011 Canonical Ltd. | 3 | # Copyright 2011, 2012 Canonical Ltd. |
182 | 4 | # | 4 | # |
183 | 5 | # This program is free software: you can redistribute it and/or modify it | 5 | # This program is free software: you can redistribute it and/or modify it |
184 | 6 | # under the terms of the GNU General Public License version 3, as published | 6 | # under the terms of the GNU General Public License version 3, as published |
185 | @@ -24,17 +24,23 @@ | |||
186 | 24 | click_link(_get_dashboard_link()) | 24 | click_link(_get_dashboard_link()) |
187 | 25 | assert_page_title(), 'Dashboard should be opened' | 25 | assert_page_title(), 'Dashboard should be opened' |
188 | 26 | 26 | ||
189 | 27 | |||
190 | 27 | def _get_dashboard_link(): | 28 | def _get_dashboard_link(): |
191 | 28 | return get_element_by_css('#main-nav .dashboard') | 29 | return get_element_by_css('#main-nav .dashboard') |
192 | 29 | 30 | ||
193 | 31 | |||
194 | 30 | def assert_page_title(): | 32 | def assert_page_title(): |
195 | 31 | assert_title(PAGE_TITLE) | 33 | assert_title(PAGE_TITLE) |
196 | 32 | 34 | ||
197 | 35 | |||
198 | 33 | def wait_for_page_to_load(): | 36 | def wait_for_page_to_load(): |
199 | 34 | wait_for(assert_title, PAGE_TITLE) | 37 | wait_for(assert_title, PAGE_TITLE) |
200 | 35 | 38 | ||
201 | 39 | |||
202 | 36 | def assert_welcome_message(user_full_name): | 40 | def assert_welcome_message(user_full_name): |
204 | 37 | assert_text(_get_welcome_element(), 'Hi %s! Welcome Back' % user_full_name) | 41 | assert_text(_get_welcome_element(), |
205 | 42 | 'Hi %s! Welcome Back' % user_full_name[:40]) | ||
206 | 43 | |||
207 | 38 | 44 | ||
208 | 39 | def _get_welcome_element(): | 45 | def _get_welcome_element(): |
209 | 40 | return get_element_by_css('h1') | 46 | return get_element_by_css('h1') |
210 | 41 | 47 | ||
211 | === modified file 'ubuntuone/web/tests/sst/shared/actions/files.py' | |||
212 | --- ubuntuone/web/tests/sst/shared/actions/files.py 2012-07-15 02:04:04 +0000 | |||
213 | +++ ubuntuone/web/tests/sst/shared/actions/files.py 2012-08-10 00:06:19 +0000 | |||
214 | @@ -19,7 +19,7 @@ | |||
215 | 19 | from sst.actions import * | 19 | from sst.actions import * |
216 | 20 | from sst.actions import _get_elem | 20 | from sst.actions import _get_elem |
217 | 21 | from loading import * | 21 | from loading import * |
219 | 22 | from config import * | 22 | from config import environment |
220 | 23 | import urlparse | 23 | import urlparse |
221 | 24 | 24 | ||
222 | 25 | 25 | ||
223 | @@ -229,13 +229,7 @@ | |||
224 | 229 | identifier -- The identifier of the file. | 229 | identifier -- The identifier of the file. |
225 | 230 | 230 | ||
226 | 231 | """ | 231 | """ |
234 | 232 | files_url = None | 232 | files_url = environment.get_environment().files_url |
228 | 233 | if ENVIRONMENT == 'staging': | ||
229 | 234 | files_url = 'https://files.staging.one.ubuntu.com/' | ||
230 | 235 | elif ENVIRONMENT == 'edge': | ||
231 | 236 | files_url = 'https://files.edge.one.ubuntu.com/' | ||
232 | 237 | elif ENVIRONMENT == 'production': | ||
233 | 238 | files_url = 'https://files.one.ubuntu.com/' | ||
235 | 239 | file_url = files_url + str(identifier[3:]) | 233 | file_url = files_url + str(identifier[3:]) |
236 | 240 | return get_element(css_class='download-button', href=file_url) | 234 | return get_element(css_class='download-button', href=file_url) |
237 | 241 | 235 | ||
238 | 242 | 236 | ||
239 | === modified file 'ubuntuone/web/tests/sst/shared/actions/setup.py' | |||
240 | --- ubuntuone/web/tests/sst/shared/actions/setup.py 2012-07-15 05:27:44 +0000 | |||
241 | +++ ubuntuone/web/tests/sst/shared/actions/setup.py 2012-08-10 00:06:19 +0000 | |||
242 | @@ -17,27 +17,27 @@ | |||
243 | 17 | """Set up actions for Ubuntu One sst tests.""" | 17 | """Set up actions for Ubuntu One sst tests.""" |
244 | 18 | 18 | ||
245 | 19 | from sst.actions import * | 19 | from sst.actions import * |
247 | 20 | from config import * | 20 | from config import schema |
248 | 21 | from config import environment | ||
249 | 21 | from data.user import User | 22 | from data.user import User |
250 | 23 | from data.environment import Environment | ||
251 | 22 | import actions.header as header_actions | 24 | import actions.header as header_actions |
252 | 23 | import actions.sso as sso_actions | 25 | import actions.sso as sso_actions |
253 | 24 | import actions.services as services_actions | 26 | import actions.services as services_actions |
254 | 25 | import actions.dashboard as dashboard_actions | 27 | import actions.dashboard as dashboard_actions |
255 | 26 | import uuid | 28 | import uuid |
256 | 27 | from utils import mail | 29 | from utils import mail |
257 | 28 | try: | ||
258 | 29 | from _passwords import full_name, email, password | ||
259 | 30 | except: | ||
260 | 31 | skip('Try adding a _passwords.py file to the shared folder if you ' \ | ||
261 | 32 | 'expect this to work. Read the README.txt file ;)') | ||
262 | 33 | 30 | ||
263 | 31 | # The user account for the test. | ||
264 | 32 | user = None | ||
265 | 34 | 33 | ||
266 | 35 | def setup(login_or_sign_up=True, new_user=False, user=None): | 34 | def setup(login_or_sign_up=True, new_user=False, user=None): |
268 | 36 | set_wait_timeout(DEFAULT_TIMEOUT) | 35 | config_values = schema.glue.schema_parser.values('__main__') |
269 | 36 | set_wait_timeout(config_values.get('default_timeout')) | ||
270 | 37 | _go_to_ubuntu_one_home() | 37 | _go_to_ubuntu_one_home() |
271 | 38 | _clear_previous_session() | 38 | _clear_previous_session() |
272 | 39 | if login_or_sign_up: | 39 | if login_or_sign_up: |
274 | 40 | _get_user_and_login_or_sign_up(new_user, user) | 40 | _make_user_and_login_or_sign_up(new_user, user) |
275 | 41 | 41 | ||
276 | 42 | 42 | ||
277 | 43 | def _go_to_ubuntu_one_home(): | 43 | def _go_to_ubuntu_one_home(): |
278 | @@ -47,21 +47,7 @@ | |||
279 | 47 | 47 | ||
280 | 48 | 48 | ||
281 | 49 | def get_base_url(): | 49 | def get_base_url(): |
297 | 50 | base_url = None | 50 | return environment.get_environment().url |
283 | 51 | if ENVIRONMENT == 'staging': | ||
284 | 52 | base_url = 'https://staging.one.ubuntu.com' | ||
285 | 53 | elif ENVIRONMENT == 'edge': | ||
286 | 54 | base_url = 'https://edge.one.ubuntu.com' | ||
287 | 55 | elif ENVIRONMENT == 'production': | ||
288 | 56 | base_url = 'https://one.ubuntu.com' | ||
289 | 57 | elif ENVIRONMENT == 'development': | ||
290 | 58 | if address: | ||
291 | 59 | base_url = address | ||
292 | 60 | else: | ||
293 | 61 | skip('development target specified, but address not set.') | ||
294 | 62 | else: | ||
295 | 63 | skip('Unknown environment: %s.' % ENVIRONMENT) | ||
296 | 64 | return base_url | ||
298 | 65 | 51 | ||
299 | 66 | 52 | ||
300 | 67 | def _clear_previous_session(): | 53 | def _clear_previous_session(): |
301 | @@ -76,23 +62,52 @@ | |||
302 | 76 | _go_to_ubuntu_one_home() | 62 | _go_to_ubuntu_one_home() |
303 | 77 | 63 | ||
304 | 78 | 64 | ||
306 | 79 | def _get_user_and_login_or_sign_up(new_user, user): | 65 | def _make_user_and_login_or_sign_up(new_user, user): |
307 | 80 | if user is None: | 66 | if user is None: |
309 | 81 | user = _get_user(new_user) | 67 | user = _make_user(new_user) |
310 | 68 | _set_user(user) | ||
311 | 82 | _login_or_sign_up(new_user, user) | 69 | _login_or_sign_up(new_user, user) |
312 | 83 | dashboard_actions.wait_for_page_to_load() | 70 | dashboard_actions.wait_for_page_to_load() |
313 | 84 | header_actions.assert_login(user.full_name) | 71 | header_actions.assert_login(user.full_name) |
314 | 85 | 72 | ||
315 | 86 | 73 | ||
317 | 87 | def _get_user(new_user): | 74 | def _make_user(new_user): |
318 | 88 | test_user = None | 75 | test_user = None |
319 | 89 | if new_user: | 76 | if new_user: |
321 | 90 | test_user = _get_random_user() | 77 | test_user = _make_random_user() |
322 | 91 | else: | 78 | else: |
324 | 92 | test_user = _get_user_from_configuration() | 79 | test_user = _make_user_from_configuration() |
325 | 93 | return test_user | 80 | return test_user |
326 | 94 | 81 | ||
327 | 95 | 82 | ||
328 | 83 | def _make_random_user(): | ||
329 | 84 | random_user_uuid = str(uuid.uuid1()) | ||
330 | 85 | config_values = schema.glue.schema_parser.values('NewUser') | ||
331 | 86 | full_name_pattern = config_values.get('full_name_pattern') | ||
332 | 87 | email_address_pattern = config_values.get('email_address_pattern') | ||
333 | 88 | random_full_name = full_name_pattern % random_user_uuid | ||
334 | 89 | random_email_address = email_address_pattern % random_user_uuid | ||
335 | 90 | password = config_values.get('password') | ||
336 | 91 | return User(random_full_name, random_email_address, password) | ||
337 | 92 | |||
338 | 93 | |||
339 | 94 | def _make_user_from_configuration(): | ||
340 | 95 | config_values = schema.glue.schema_parser.values('DefaultUser') | ||
341 | 96 | full_name = config_values.get('full_name') | ||
342 | 97 | email_address = config_values.get('email_address') | ||
343 | 98 | password = config_values.get('password') | ||
344 | 99 | return User(full_name, email_address, password) | ||
345 | 100 | |||
346 | 101 | |||
347 | 102 | def _set_user(user_data): | ||
348 | 103 | global user | ||
349 | 104 | user = user_data | ||
350 | 105 | |||
351 | 106 | |||
352 | 107 | def get_user(): | ||
353 | 108 | return user | ||
354 | 109 | |||
355 | 110 | |||
356 | 96 | def _login_or_sign_up(new_user, user): | 111 | def _login_or_sign_up(new_user, user): |
357 | 97 | if new_user: | 112 | if new_user: |
358 | 98 | _sign_up(user) | 113 | _sign_up(user) |
359 | @@ -100,26 +115,15 @@ | |||
360 | 100 | _login(user) | 115 | _login(user) |
361 | 101 | 116 | ||
362 | 102 | 117 | ||
363 | 103 | def _get_user_from_configuration(): | ||
364 | 104 | return User(full_name, email, password) | ||
365 | 105 | |||
366 | 106 | |||
367 | 107 | def _get_random_user(): | ||
368 | 108 | random_user_uuid = str(uuid.uuid1()) | ||
369 | 109 | random_user_name = 'Test user ' + random_user_uuid | ||
370 | 110 | random_user_email = random_user_uuid + '@' + IMAP_SERVER | ||
371 | 111 | random_user_password = 'Hola123*' | ||
372 | 112 | return User(random_user_name, random_user_email, random_user_password) | ||
373 | 113 | |||
374 | 114 | 118 | ||
375 | 115 | def _sign_up(user): | 119 | def _sign_up(user): |
379 | 116 | if ENVIRONMENT == 'production': | 120 | if environment.can_create_new_users(): |
377 | 117 | skip('Can\'t create new users on production.') | ||
378 | 118 | else: | ||
380 | 119 | header_actions.click_login_or_sign_up() | 121 | header_actions.click_login_or_sign_up() |
381 | 120 | sso_actions.create_new_account(user) | 122 | sso_actions.create_new_account(user) |
382 | 121 | _confirm_email(user.email) | 123 | _confirm_email(user.email) |
384 | 122 | services_actions.agree_and_subscribe_to_free_plan() | 124 | services_actions.agree_and_subscribe_to_free_plan() |
385 | 125 | else: | ||
386 | 126 | skip('Can\'t create new users on this environment.') | ||
387 | 123 | 127 | ||
388 | 124 | 128 | ||
389 | 125 | def _confirm_email(email): | 129 | def _confirm_email(email): |
390 | @@ -130,7 +134,7 @@ | |||
391 | 130 | 134 | ||
392 | 131 | def _login(user): | 135 | def _login(user): |
393 | 132 | header_actions.click_login_or_sign_up() | 136 | header_actions.click_login_or_sign_up() |
395 | 133 | if ENVIRONMENT == 'development': | 137 | if environment.is_development_environment(): |
396 | 134 | wait_for(assert_title, 'Ubuntu One :') | 138 | wait_for(assert_title, 'Ubuntu One :') |
397 | 135 | switch_to_window() | 139 | switch_to_window() |
398 | 136 | click_button(get_elements('button.cta[type="submit"]')[0], wait=False) | 140 | click_button(get_elements('button.cta[type="submit"]')[0], wait=False) |
399 | 137 | 141 | ||
400 | === added directory 'ubuntuone/web/tests/sst/shared/config' | |||
401 | === removed file 'ubuntuone/web/tests/sst/shared/config.py' | |||
402 | --- ubuntuone/web/tests/sst/shared/config.py 2012-06-04 21:23:42 +0000 | |||
403 | +++ ubuntuone/web/tests/sst/shared/config.py 1970-01-01 00:00:00 +0000 | |||
404 | @@ -1,38 +0,0 @@ | |||
405 | 1 | # -*- coding: utf-8 -*- | ||
406 | 2 | |||
407 | 3 | # Copyright 2011-2012 Canonical Ltd. | ||
408 | 4 | # | ||
409 | 5 | # This program is free software: you can redistribute it and/or modify it | ||
410 | 6 | # under the terms of the GNU General Public License version 3, as published | ||
411 | 7 | # by the Free Software Foundation. | ||
412 | 8 | # | ||
413 | 9 | # This program is distributed in the hope that it will be useful, but | ||
414 | 10 | # WITHOUT ANY WARRANTY; without even the implied warranties of | ||
415 | 11 | # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
416 | 12 | # PURPOSE. See the GNU General Public License for more details. | ||
417 | 13 | # | ||
418 | 14 | # You should have received a copy of the GNU General Public License along | ||
419 | 15 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
420 | 16 | |||
421 | 17 | # Waiting actions will wait for this amount of seconds, unless a different | ||
422 | 18 | # timeout is set calling the SST action set_wait_timeout. | ||
423 | 19 | DEFAULT_TIMEOUT = 40 | ||
424 | 20 | |||
425 | 21 | # set below according to need (staging v production v edge v development | ||
426 | 22 | # test instance) | ||
427 | 23 | ENVIRONMENT = 'staging' | ||
428 | 24 | #ENVIRONMENT = 'edge' | ||
429 | 25 | #ENVIRONMENT = 'production' | ||
430 | 26 | #ENVIRONMENT = 'development' | ||
431 | 27 | |||
432 | 28 | # Email inbox data | ||
433 | 29 | IMAP_SERVER = 'mail.canonical.com' | ||
434 | 30 | IMAP_USERNAME = 'u1test' | ||
435 | 31 | IMAP_PASSWORD = 'password' | ||
436 | 32 | |||
437 | 33 | # You can overwrite the default configuration setting the variables on | ||
438 | 34 | # the file shared/_local_config.py. | ||
439 | 35 | try: | ||
440 | 36 | from _localconfig import * | ||
441 | 37 | except ImportError: | ||
442 | 38 | pass | ||
443 | 39 | 0 | ||
444 | === added file 'ubuntuone/web/tests/sst/shared/config/__init__.py' | |||
445 | === added file 'ubuntuone/web/tests/sst/shared/config/environment.py' | |||
446 | --- ubuntuone/web/tests/sst/shared/config/environment.py 1970-01-01 00:00:00 +0000 | |||
447 | +++ ubuntuone/web/tests/sst/shared/config/environment.py 2012-08-10 00:06:19 +0000 | |||
448 | @@ -0,0 +1,49 @@ | |||
449 | 1 | # -*- coding: utf-8 -*- | ||
450 | 2 | |||
451 | 3 | # Copyright 2012 Canonical Ltd. | ||
452 | 4 | # | ||
453 | 5 | # This program is free software: you can redistribute it and/or modify it | ||
454 | 6 | # under the terms of the GNU General Public License version 3, as published | ||
455 | 7 | # by the Free Software Foundation. | ||
456 | 8 | # | ||
457 | 9 | # This program is distributed in the hope that it will be useful, but | ||
458 | 10 | # WITHOUT ANY WARRANTY; without even the implied warranties of | ||
459 | 11 | # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
460 | 12 | # PURPOSE. See the GNU General Public License for more details. | ||
461 | 13 | # | ||
462 | 14 | # You should have received a copy of the GNU General Public License along | ||
463 | 15 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
464 | 16 | |||
465 | 17 | from config import schema | ||
466 | 18 | from data.environment import Environment | ||
467 | 19 | |||
468 | 20 | environment_data = None | ||
469 | 21 | |||
470 | 22 | def get_environment(): | ||
471 | 23 | global environment_data | ||
472 | 24 | if not environment_data: | ||
473 | 25 | config_values = schema.glue.schema_parser.values('Server') | ||
474 | 26 | name = config_values.get('environment') | ||
475 | 27 | url = config_values.get('url') | ||
476 | 28 | sso_url = config_values.get('sso_url') | ||
477 | 29 | files_url = config_values.get('files_url') | ||
478 | 30 | environment_data = Environment(name, url, sso_url, files_url) | ||
479 | 31 | return environment_data | ||
480 | 32 | |||
481 | 33 | |||
482 | 34 | def is_staging_environment(): | ||
483 | 35 | return get_environment().name == 'staging' | ||
484 | 36 | |||
485 | 37 | |||
486 | 38 | def is_development_environment(): | ||
487 | 39 | return get_environment().name == 'production' | ||
488 | 40 | |||
489 | 41 | |||
490 | 42 | def can_create_new_users(): | ||
491 | 43 | return is_staging_environment() | ||
492 | 44 | |||
493 | 45 | |||
494 | 46 | def can_make_payments(): | ||
495 | 47 | return is_staging_environment() | ||
496 | 48 | |||
497 | 49 | |||
498 | 0 | 50 | ||
499 | === added file 'ubuntuone/web/tests/sst/shared/config/sample.cfg' | |||
500 | --- ubuntuone/web/tests/sst/shared/config/sample.cfg 1970-01-01 00:00:00 +0000 | |||
501 | +++ ubuntuone/web/tests/sst/shared/config/sample.cfg 2012-08-10 00:06:19 +0000 | |||
502 | @@ -0,0 +1,25 @@ | |||
503 | 1 | [__main__] | ||
504 | 2 | default_timeout: 40 | ||
505 | 3 | |||
506 | 4 | [Server] | ||
507 | 5 | environment: staging | ||
508 | 6 | |||
509 | 7 | [DefaultUser] | ||
510 | 8 | full_name: Test user | ||
511 | 9 | email_address: test@example.com | ||
512 | 10 | password: Hola123* | ||
513 | 11 | |||
514 | 12 | [NewUser] | ||
515 | 13 | full_name_pattern: Test user %s | ||
516 | 14 | email_address_pattern: test+%s@example.com | ||
517 | 15 | password: Hola123* | ||
518 | 16 | imap_server: mail.example.com | ||
519 | 17 | imap_port: 993 | ||
520 | 18 | imap_use_ssl: True | ||
521 | 19 | imap_username: test | ||
522 | 20 | imap_password: Hola123* | ||
523 | 21 | |||
524 | 22 | [MusicUser] | ||
525 | 23 | full_name: Test user | ||
526 | 24 | email_address: test@example.com | ||
527 | 25 | password: Hola123* | ||
528 | 0 | \ No newline at end of file | 26 | \ No newline at end of file |
529 | 1 | 27 | ||
530 | === added file 'ubuntuone/web/tests/sst/shared/config/schema.py' | |||
531 | --- ubuntuone/web/tests/sst/shared/config/schema.py 1970-01-01 00:00:00 +0000 | |||
532 | +++ ubuntuone/web/tests/sst/shared/config/schema.py 2012-08-10 00:06:19 +0000 | |||
533 | @@ -0,0 +1,61 @@ | |||
534 | 1 | # -*- coding: utf-8 -*- | ||
535 | 2 | |||
536 | 3 | # Copyright 2012 Canonical Ltd. | ||
537 | 4 | # | ||
538 | 5 | # This program is free software: you can redistribute it and/or modify it | ||
539 | 6 | # under the terms of the GNU General Public License version 3, as published | ||
540 | 7 | # by the Free Software Foundation. | ||
541 | 8 | # | ||
542 | 9 | # This program is distributed in the hope that it will be useful, but | ||
543 | 10 | # WITHOUT ANY WARRANTY; without even the implied warranties of | ||
544 | 11 | # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
545 | 12 | # PURPOSE. See the GNU General Public License for more details. | ||
546 | 13 | # | ||
547 | 14 | # You should have received a copy of the GNU General Public License along | ||
548 | 15 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
549 | 16 | |||
550 | 17 | from configglue import schema | ||
551 | 18 | from configglue.glue import configglue | ||
552 | 19 | import sys | ||
553 | 20 | import os.path | ||
554 | 21 | |||
555 | 22 | class SstSchema(schema.Schema): | ||
556 | 23 | |||
557 | 24 | default_timeout = schema.IntOption(default=40) | ||
558 | 25 | |||
559 | 26 | class Server(schema.Section): | ||
560 | 27 | environment = schema.StringOption(default='staging') | ||
561 | 28 | url = schema.StringOption(default=None) | ||
562 | 29 | sso_url = schema.StringOption(default=None) | ||
563 | 30 | files_url = schema.StringOption(default=None) | ||
564 | 31 | |||
565 | 32 | |||
566 | 33 | class DefaultUser(schema.Section): | ||
567 | 34 | full_name = schema.StringOption() | ||
568 | 35 | email_address = schema.StringOption() | ||
569 | 36 | password = schema.StringOption() | ||
570 | 37 | |||
571 | 38 | |||
572 | 39 | class NewUser(schema.Section): | ||
573 | 40 | full_name_pattern = schema.StringOption(default='Test user %s', | ||
574 | 41 | raw=True) | ||
575 | 42 | email_address_pattern = schema.StringOption(raw=True) | ||
576 | 43 | password = schema.StringOption(default='Hola123*') | ||
577 | 44 | imap_server = schema.StringOption() | ||
578 | 45 | imap_port = schema.IntOption(default=993) | ||
579 | 46 | imap_use_ssl = schema.BoolOption(default=True) | ||
580 | 47 | imap_username = schema.StringOption() | ||
581 | 48 | imap_password = schema.StringOption() | ||
582 | 49 | |||
583 | 50 | |||
584 | 51 | class MusicUser(schema.Section): | ||
585 | 52 | full_name = schema.StringOption() | ||
586 | 53 | email_address = schema.StringOption() | ||
587 | 54 | password = schema.StringOption() | ||
588 | 55 | |||
589 | 56 | # XXX The command line arguments are for SST, not for u1 tests. | ||
590 | 57 | # We will do something to SST on the future so it uses configglue, | ||
591 | 58 | # or makes available all the additional arguments. | ||
592 | 59 | sys.argv = [] | ||
593 | 60 | current_dir = os.path.dirname(os.path.abspath(__file__)) | ||
594 | 61 | glue = configglue(SstSchema, os.path.join(current_dir, 'local.cfg')) | ||
595 | 0 | 62 | ||
596 | === added file 'ubuntuone/web/tests/sst/shared/data/environment.py' | |||
597 | --- ubuntuone/web/tests/sst/shared/data/environment.py 1970-01-01 00:00:00 +0000 | |||
598 | +++ ubuntuone/web/tests/sst/shared/data/environment.py 2012-08-10 00:06:19 +0000 | |||
599 | @@ -0,0 +1,44 @@ | |||
600 | 1 | # -*- coding: utf-8 -*- | ||
601 | 2 | |||
602 | 3 | # Copyright 2012 Canonical Ltd. | ||
603 | 4 | # | ||
604 | 5 | # This program is free software: you can redistribute it and/or modify it | ||
605 | 6 | # under the terms of the GNU General Public License version 3, as published | ||
606 | 7 | # by the Free Software Foundation. | ||
607 | 8 | # | ||
608 | 9 | # This program is distributed in the hope that it will be useful, but | ||
609 | 10 | # WITHOUT ANY WARRANTY; without even the implied warranties of | ||
610 | 11 | # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
611 | 12 | # PURPOSE. See the GNU General Public License for more details. | ||
612 | 13 | # | ||
613 | 14 | # You should have received a copy of the GNU General Public License along | ||
614 | 15 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
615 | 16 | |||
616 | 17 | base_urls = {'staging': 'https://staging.one.ubuntu.com', | ||
617 | 18 | 'edge': 'https://edge.one.ubuntu.com', | ||
618 | 19 | 'production': 'https://one.ubuntu.com'} | ||
619 | 20 | sso_urls = {'staging': 'https://loging.staging.ubuntu.com', | ||
620 | 21 | 'edge': 'https://loging.ubuntu.com', | ||
621 | 22 | 'production': 'https://loging.ubuntu.com'} | ||
622 | 23 | files_urls = {'staging': 'https://staging.one.ubuntu.com', | ||
623 | 24 | 'edge': 'https://edge.one.ubuntu.com', | ||
624 | 25 | 'production': 'https://one.ubuntu.com'} | ||
625 | 26 | |||
626 | 27 | class Environment: | ||
627 | 28 | |||
628 | 29 | def __init__(self, name, url, sso_url, files_url): | ||
629 | 30 | self.name = name | ||
630 | 31 | if url: | ||
631 | 32 | self.url = url | ||
632 | 33 | else: | ||
633 | 34 | self.url = base_urls[name] | ||
634 | 35 | if sso_url: | ||
635 | 36 | self.sso_url = sso_url | ||
636 | 37 | else: | ||
637 | 38 | self.sso_url = sso_urls[name] | ||
638 | 39 | if files_url: | ||
639 | 40 | self.files_url = files_url | ||
640 | 41 | else: | ||
641 | 42 | self.files_url = files_urls[name] | ||
642 | 43 | |||
643 | 44 | |||
644 | 0 | 45 | ||
645 | === removed file 'ubuntuone/web/tests/sst/shared/edge_config.py' | |||
646 | --- ubuntuone/web/tests/sst/shared/edge_config.py 2011-09-29 17:53:44 +0000 | |||
647 | +++ ubuntuone/web/tests/sst/shared/edge_config.py 1970-01-01 00:00:00 +0000 | |||
648 | @@ -1,2 +0,0 @@ | |||
649 | 1 | # set below according to need (staging v production v test instance) | ||
650 | 2 | base_url = 'https://edge.one.ubuntu.com/' | ||
651 | 3 | 0 | ||
652 | === removed file 'ubuntuone/web/tests/sst/shared/prod_config.py' | |||
653 | --- ubuntuone/web/tests/sst/shared/prod_config.py 2011-09-29 17:53:44 +0000 | |||
654 | +++ ubuntuone/web/tests/sst/shared/prod_config.py 1970-01-01 00:00:00 +0000 | |||
655 | @@ -1,2 +0,0 @@ | |||
656 | 1 | # set below according to need (staging v production v test instance) | ||
657 | 2 | base_url = 'https://one.ubuntu.com/' | ||
658 | 3 | 0 | ||
659 | === removed file 'ubuntuone/web/tests/sst/shared/stag_config.py' | |||
660 | --- ubuntuone/web/tests/sst/shared/stag_config.py 2011-09-29 17:53:44 +0000 | |||
661 | +++ ubuntuone/web/tests/sst/shared/stag_config.py 1970-01-01 00:00:00 +0000 | |||
662 | @@ -1,2 +0,0 @@ | |||
663 | 1 | # set below according to need (staging v production v test instance) | ||
664 | 2 | base_url = 'https://staging.one.ubuntu.com/' | ||
665 | 3 | 0 | ||
666 | === modified file 'ubuntuone/web/tests/sst/shared/utils/mail.py' | |||
667 | --- ubuntuone/web/tests/sst/shared/utils/mail.py 2012-03-19 19:20:22 +0000 | |||
668 | +++ ubuntuone/web/tests/sst/shared/utils/mail.py 2012-08-10 00:06:19 +0000 | |||
669 | @@ -1,6 +1,6 @@ | |||
670 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
671 | 2 | 2 | ||
673 | 3 | # Copyright 2011 Canonical Ltd. | 3 | # Copyright 2011, 2012 Canonical Ltd. |
674 | 4 | # | 4 | # |
675 | 5 | # This program is free software: you can redistribute it and/or modify it | 5 | # This program is free software: you can redistribute it and/or modify it |
676 | 6 | # under the terms of the GNU General Public License version 3, as published | 6 | # under the terms of the GNU General Public License version 3, as published |
677 | @@ -21,7 +21,7 @@ | |||
678 | 21 | import imaplib | 21 | import imaplib |
679 | 22 | import time | 22 | import time |
680 | 23 | from email import email | 23 | from email import email |
682 | 24 | from config import IMAP_SERVER, IMAP_USERNAME, IMAP_PASSWORD | 24 | from config import schema |
683 | 25 | 25 | ||
684 | 26 | def get_confirmation_code_for_address(email_address): | 26 | def get_confirmation_code_for_address(email_address): |
685 | 27 | email_msg = get_latest_email_sent_to(email_address) | 27 | email_msg = get_latest_email_sent_to(email_address) |
686 | @@ -40,17 +40,27 @@ | |||
687 | 40 | raise AssertionError("No verification link found in email.") | 40 | raise AssertionError("No verification link found in email.") |
688 | 41 | return vcode | 41 | return vcode |
689 | 42 | 42 | ||
690 | 43 | |||
691 | 43 | def get_latest_email_sent_to(email_address): | 44 | def get_latest_email_sent_to(email_address): |
693 | 44 | with MailBox(IMAP_USERNAME, IMAP_PASSWORD) as mbox: | 45 | with MailBox() as mbox: |
694 | 45 | email_msg = mbox.get_latest_email_sent_to(email_address) | 46 | email_msg = mbox.get_latest_email_sent_to(email_address) |
695 | 46 | mbox.delete_msgs_sent_to(email_address) | 47 | mbox.delete_msgs_sent_to(email_address) |
696 | 47 | return email_msg | 48 | return email_msg |
698 | 48 | 49 | ||
699 | 50 | |||
700 | 49 | class MailBox(object): | 51 | class MailBox(object): |
705 | 50 | def __init__(self, user, password): | 52 | |
706 | 51 | self.user = user | 53 | def __init__(self): |
707 | 52 | self.password = password | 54 | config_values = schema.glue.schema_parser.values('NewUser') |
708 | 53 | self.imap = imaplib.IMAP4_SSL(IMAP_SERVER, 993) | 55 | self.user = config_values.get('imap_username') |
709 | 56 | self.password = config_values.get('imap_password') | ||
710 | 57 | imap_server = config_values.get('imap_server') | ||
711 | 58 | imap_port = config_values.get('imap_port') | ||
712 | 59 | imap_use_ssl = config_values.get('imap_use_ssl') | ||
713 | 60 | if imap_use_ssl: | ||
714 | 61 | self.imap = imaplib.IMAP4_SSL(imap_server, imap_port) | ||
715 | 62 | else: | ||
716 | 63 | self.imap = imaplib.IMAP4(imap_server, imap_port) | ||
717 | 54 | 64 | ||
718 | 55 | def __enter__(self): | 65 | def __enter__(self): |
719 | 56 | self.imap.login(self.user, self.password) | 66 | self.imap.login(self.user, self.password) |
looks good. ran tests with local config.