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
=== modified file 'ubuntuone/web/tests/sst/payments/u1webp002_payadditionalstorage.py'
--- ubuntuone/web/tests/sst/payments/u1webp002_payadditionalstorage.py 2011-12-09 18:18:25 +0000
+++ ubuntuone/web/tests/sst/payments/u1webp002_payadditionalstorage.py 2012-03-21 22:25:18 +0000
@@ -4,7 +4,7 @@
4# Rick McBride <rick.mcbride@canonical.com>4# Rick McBride <rick.mcbride@canonical.com>
5# Leo Arias <leo.arias@canonical.com>5# Leo Arias <leo.arias@canonical.com>
6#6#
7# Copyright 2011 Canonical Ltd.7# Copyright 2011-2012 Canonical Ltd.
8#8#
9# This program is free software: you can redistribute it and/or modify it9# This program is free software: you can redistribute it and/or modify it
10# under the terms of the GNU General Public License version 3, as published10# under the terms of the GNU General Public License version 3, as published
@@ -27,8 +27,6 @@
27import actions.payment as payment_actions27import actions.payment as payment_actions
28import actions.payment_confirmed as payment_confirmed_actions28import actions.payment_confirmed as payment_confirmed_actions
2929
30if ENVIRONMENT == 'production':
31 skip('Can\'t test payments on production.')
32setup_actions.setup(new_user=True)30setup_actions.setup(new_user=True)
33services_actions.open()31services_actions.open()
34services_actions.buy_extra_storage()32services_actions.buy_extra_storage()
@@ -39,4 +37,4 @@
39payment_confirmed_actions.view_account()37payment_confirmed_actions.view_account()
40# TODO move this to the module account actions.38# TODO move this to the module account actions.
41get_element(tag='span', text='5GB with Ubuntu One Free')39get_element(tag='span', text='5GB with Ubuntu One Free')
42get_element(tag='span', text='100GB from storage add-on')40get_element(tag='span', text='20GB from storage add-on')
4341
=== modified file 'ubuntuone/web/tests/sst/shared/actions/setup.py'
--- ubuntuone/web/tests/sst/shared/actions/setup.py 2011-12-19 15:35:59 +0000
+++ ubuntuone/web/tests/sst/shared/actions/setup.py 2012-03-21 22:25:18 +0000
@@ -1,6 +1,6 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
22
3# Copyright 2011 Canonical Ltd.3# Copyright 2011-2012 Canonical Ltd.
4#4#
5# This program is free software: you can redistribute it and/or modify it5# This program is free software: you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 3, as published6# under the terms of the GNU General Public License version 3, as published
@@ -33,40 +33,22 @@
3333
3434
35def setup(new_user=False, user=None):35def setup(new_user=False, user=None):
36 """Log in to the Ubuntu One website. Optionally, you can create a new user.36 """After calling setup, the browser will be in the Dashboard ready to
37
38 After calling setup, the browser will be in the Dashboard ready to
39 start testing.37 start testing.
4038
41 Keyword arguments:
42 new_user -- Indicates if a new user has to be created for the test.
43
44 """39 """
40 set_wait_timeout(DEFAULT_TIMEOUT)
41 _go_to_ubuntu_one_home()
42 if user is None:
43 user = _get_user_from_configuration(new_user)
44 _sign_up_or_login(new_user, user)
45 dashboard_actions.wait_for_page_to_load()
46 header_actions.assert_login(user.full_name)
47
48def _go_to_ubuntu_one_home():
45 set_base_url(get_base_url())49 set_base_url(get_base_url())
46 set_wait_timeout(DEFAULT_TIMEOUT)
47 go_to()50 go_to()
48 wait_for(assert_title, 'Ubuntu One : Home')51 wait_for(assert_title, 'Ubuntu One : Home')
49 header_actions.click_login_or_sign_up()
50 test_user = user
51 if new_user:
52 if user is None:
53 user_uuid = str(uuid.uuid1())
54 user_name = 'Test user ' + user_uuid
55 user_email = user_uuid + '@' + IMAP_SERVER
56 user_password = 'Hola123*'
57 test_user = User(user_name, user_email, user_password)
58 sso_actions.create_new_account(test_user)
59 confirmation_code = \
60 mail.get_confirmation_code_for_address(test_user.email)
61 sso_actions.confirm_email(confirmation_code)
62 else:
63 if user is None:
64 test_user = User(full_name, email, password)
65 sso_actions.login(test_user)
66 if new_user:
67 services_actions.agree_and_subscribe_to_free_plan()
68 dashboard_actions.wait_for_page_to_load()
69 header_actions.assert_login(test_user.full_name)
7052
71def get_base_url():53def get_base_url():
72 base_url = None54 base_url = None
@@ -79,3 +61,42 @@
79 else:61 else:
80 skip('Unknown environment: %s.' % ENVIRONMENT)62 skip('Unknown environment: %s.' % ENVIRONMENT)
81 return base_url63 return base_url
64
65def _sign_up_or_login(new_user, user):
66 if new_user:
67 _sign_up(user)
68 else:
69 _login(user)
70
71def _get_user_from_configuration(new_user):
72 test_user = None
73 if new_user:
74 test_user = _get_random_user()
75 else:
76 test_user = User(full_name, email, password)
77 return test_user
78
79def _get_random_user():
80 random_user_uuid = str(uuid.uuid1())
81 random_user_name = 'Test user ' + random_user_uuid
82 random_user_email = random_user_uuid + '@' + IMAP_SERVER
83 random_user_password = 'Hola123*'
84 return User(random_user_name, random_user_email, random_user_password)
85
86def _sign_up(user):
87 if ENVIRONMENT == 'production':
88 skip('Can\'t create new users on production.')
89 else:
90 header_actions.click_login_or_sign_up()
91 sso_actions.create_new_account(user)
92 _confirm_email(user.email)
93 services_actions.agree_and_subscribe_to_free_plan()
94
95def _confirm_email(email):
96 confirmation_code = \
97 mail.get_confirmation_code_for_address(email)
98 sso_actions.confirm_email(confirmation_code)
99
100def _login(user):
101 header_actions.click_login_or_sign_up()
102 sso_actions.login(user)

Subscribers

People subscribed via source and target branches