Merge lp:~elopio/ubuntuone-testing/fix-payadditionalstorage into lp:ubuntuone-testing

Proposed by Leo Arias
Status: Merged
Approved by: Rick McBride
Approved revision: 87
Merged at revision: 85
Proposed branch: lp:~elopio/ubuntuone-testing/fix-payadditionalstorage
Merge into: lp:ubuntuone-testing
Diff against target: 133 lines (+52/-33)
2 files modified
ubuntuone/web/tests/sst/payments/u1webp002_payadditionalstorage.py (+2/-4)
ubuntuone/web/tests/sst/shared/actions/setup.py (+50/-29)
To merge this branch: bzr merge lp:~elopio/ubuntuone-testing/fix-payadditionalstorage
Reviewer Review Type Date Requested Status
Rick McBride (community) Approve
Review via email: mp+98749@code.launchpad.net

Commit message

Fixed the expected additional storage space and cleaned the setup code.

Description of the change

Fixed the expected additional storage space.
Cleaned up the setup actions.

To post a comment you must log in.
Revision history for this message
Rick McBride (rmcbride) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/web/tests/sst/payments/u1webp002_payadditionalstorage.py'
2--- ubuntuone/web/tests/sst/payments/u1webp002_payadditionalstorage.py 2011-12-09 18:18:25 +0000
3+++ ubuntuone/web/tests/sst/payments/u1webp002_payadditionalstorage.py 2012-03-21 22:25:18 +0000
4@@ -4,7 +4,7 @@
5 # Rick McBride <rick.mcbride@canonical.com>
6 # Leo Arias <leo.arias@canonical.com>
7 #
8-# Copyright 2011 Canonical Ltd.
9+# Copyright 2011-2012 Canonical Ltd.
10 #
11 # This program is free software: you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License version 3, as published
13@@ -27,8 +27,6 @@
14 import actions.payment as payment_actions
15 import actions.payment_confirmed as payment_confirmed_actions
16
17-if ENVIRONMENT == 'production':
18- skip('Can\'t test payments on production.')
19 setup_actions.setup(new_user=True)
20 services_actions.open()
21 services_actions.buy_extra_storage()
22@@ -39,4 +37,4 @@
23 payment_confirmed_actions.view_account()
24 # TODO move this to the module account actions.
25 get_element(tag='span', text='5GB with Ubuntu One Free')
26-get_element(tag='span', text='100GB from storage add-on')
27+get_element(tag='span', text='20GB from storage add-on')
28
29=== modified file 'ubuntuone/web/tests/sst/shared/actions/setup.py'
30--- ubuntuone/web/tests/sst/shared/actions/setup.py 2011-12-19 15:35:59 +0000
31+++ ubuntuone/web/tests/sst/shared/actions/setup.py 2012-03-21 22:25:18 +0000
32@@ -1,6 +1,6 @@
33 # -*- coding: utf-8 -*-
34
35-# Copyright 2011 Canonical Ltd.
36+# Copyright 2011-2012 Canonical Ltd.
37 #
38 # This program is free software: you can redistribute it and/or modify it
39 # under the terms of the GNU General Public License version 3, as published
40@@ -33,40 +33,22 @@
41
42
43 def setup(new_user=False, user=None):
44- """Log in to the Ubuntu One website. Optionally, you can create a new user.
45-
46- After calling setup, the browser will be in the Dashboard ready to
47+ """After calling setup, the browser will be in the Dashboard ready to
48 start testing.
49
50- Keyword arguments:
51- new_user -- Indicates if a new user has to be created for the test.
52-
53 """
54+ set_wait_timeout(DEFAULT_TIMEOUT)
55+ _go_to_ubuntu_one_home()
56+ if user is None:
57+ user = _get_user_from_configuration(new_user)
58+ _sign_up_or_login(new_user, user)
59+ dashboard_actions.wait_for_page_to_load()
60+ header_actions.assert_login(user.full_name)
61+
62+def _go_to_ubuntu_one_home():
63 set_base_url(get_base_url())
64- set_wait_timeout(DEFAULT_TIMEOUT)
65 go_to()
66 wait_for(assert_title, 'Ubuntu One : Home')
67- header_actions.click_login_or_sign_up()
68- test_user = user
69- if new_user:
70- if user is None:
71- user_uuid = str(uuid.uuid1())
72- user_name = 'Test user ' + user_uuid
73- user_email = user_uuid + '@' + IMAP_SERVER
74- user_password = 'Hola123*'
75- test_user = User(user_name, user_email, user_password)
76- sso_actions.create_new_account(test_user)
77- confirmation_code = \
78- mail.get_confirmation_code_for_address(test_user.email)
79- sso_actions.confirm_email(confirmation_code)
80- else:
81- if user is None:
82- test_user = User(full_name, email, password)
83- sso_actions.login(test_user)
84- if new_user:
85- services_actions.agree_and_subscribe_to_free_plan()
86- dashboard_actions.wait_for_page_to_load()
87- header_actions.assert_login(test_user.full_name)
88
89 def get_base_url():
90 base_url = None
91@@ -79,3 +61,42 @@
92 else:
93 skip('Unknown environment: %s.' % ENVIRONMENT)
94 return base_url
95+
96+def _sign_up_or_login(new_user, user):
97+ if new_user:
98+ _sign_up(user)
99+ else:
100+ _login(user)
101+
102+def _get_user_from_configuration(new_user):
103+ test_user = None
104+ if new_user:
105+ test_user = _get_random_user()
106+ else:
107+ test_user = User(full_name, email, password)
108+ return test_user
109+
110+def _get_random_user():
111+ random_user_uuid = str(uuid.uuid1())
112+ random_user_name = 'Test user ' + random_user_uuid
113+ random_user_email = random_user_uuid + '@' + IMAP_SERVER
114+ random_user_password = 'Hola123*'
115+ return User(random_user_name, random_user_email, random_user_password)
116+
117+def _sign_up(user):
118+ if ENVIRONMENT == 'production':
119+ skip('Can\'t create new users on production.')
120+ else:
121+ header_actions.click_login_or_sign_up()
122+ sso_actions.create_new_account(user)
123+ _confirm_email(user.email)
124+ services_actions.agree_and_subscribe_to_free_plan()
125+
126+def _confirm_email(email):
127+ confirmation_code = \
128+ mail.get_confirmation_code_for_address(email)
129+ sso_actions.confirm_email(confirmation_code)
130+
131+def _login(user):
132+ header_actions.click_login_or_sign_up()
133+ sso_actions.login(user)

Subscribers

People subscribed via source and target branches