Merge lp:~elopio/ubuntuone-testing/environments into lp:ubuntuone-testing

Proposed by Leo Arias
Status: Merged
Approved by: Rick McBride
Approved revision: 59
Merged at revision: 58
Proposed branch: lp:~elopio/ubuntuone-testing/environments
Merge into: lp:ubuntuone-testing
Diff against target: 143 lines (+32/-5)
7 files modified
.bzrignore (+1/-0)
ubuntuone/web/tests/sst/payments/u1webp001_paymusicstreaming.py (+3/-0)
ubuntuone/web/tests/sst/payments/u1webp002_payadditionalstorage.py (+3/-0)
ubuntuone/web/tests/sst/payments/u1webp003_paywithrefusedcard.py (+3/-0)
ubuntuone/web/tests/sst/shared/actions/setup.py (+13/-2)
ubuntuone/web/tests/sst/shared/actions/sso.py (+2/-2)
ubuntuone/web/tests/sst/shared/config.py (+7/-1)
To merge this branch: bzr merge lp:~elopio/ubuntuone-testing/environments
Reviewer Review Type Date Requested Status
Rick McBride (community) Approve
Review via email: mp+83244@code.launchpad.net

Commit message

Improved the environment handling.

Description of the change

With this changes, we do a better handling of the environment and we will have the chance to run tests on different environments, and filter tests by environment.

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

Excellent idea, and well done.

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 2011-10-06 19:43:51 +0000
3+++ .bzrignore 2011-11-24 05:08:24 +0000
4@@ -9,5 +9,6 @@
5 passwords.py
6 reports/*
7 _passwords.py
8+_localconfig.py
9 sourcecode
10 results
11
12=== modified file 'ubuntuone/web/tests/sst/payments/u1webp001_paymusicstreaming.py'
13--- ubuntuone/web/tests/sst/payments/u1webp001_paymusicstreaming.py 2011-09-22 06:27:21 +0000
14+++ ubuntuone/web/tests/sst/payments/u1webp001_paymusicstreaming.py 2011-11-24 05:08:24 +0000
15@@ -21,12 +21,15 @@
16 """Pay for the music streaming service."""
17
18 from sst.actions import *
19+from config import ENVIRONMENT
20 from datetime import date
21 import actions.setup as setup_actions
22 import actions.services as services_actions
23 import actions.payment as payment_actions
24 import actions.payment_confirmed as payment_confirmed_actions
25
26+if ENVIRONMENT == 'production':
27+ skip('Can\'t test payments on production.')
28 setup_actions.setup(new_user=True)
29 services_actions.open()
30 services_actions.buy_music_streaming_yearly()
31
32=== modified file 'ubuntuone/web/tests/sst/payments/u1webp002_payadditionalstorage.py'
33--- ubuntuone/web/tests/sst/payments/u1webp002_payadditionalstorage.py 2011-09-22 06:27:21 +0000
34+++ ubuntuone/web/tests/sst/payments/u1webp002_payadditionalstorage.py 2011-11-24 05:08:24 +0000
35@@ -21,11 +21,14 @@
36 """Pay for the additional sotrage service."""
37
38 from sst.actions import *
39+from config import ENVIRONMENT
40 import actions.setup as setup_actions
41 import actions.services as services_actions
42 import actions.payment as payment_actions
43 import actions.payment_confirmed as payment_confirmed_actions
44
45+if ENVIRONMENT == 'production':
46+ skip('Can\'t test payments on production.')
47 setup_actions.setup(new_user=True)
48 services_actions.open()
49 services_actions.buy_extra_storage()
50
51=== modified file 'ubuntuone/web/tests/sst/payments/u1webp003_paywithrefusedcard.py'
52--- ubuntuone/web/tests/sst/payments/u1webp003_paywithrefusedcard.py 2011-09-22 06:27:21 +0000
53+++ ubuntuone/web/tests/sst/payments/u1webp003_paywithrefusedcard.py 2011-11-24 05:08:24 +0000
54@@ -21,11 +21,14 @@
55 """Pay for a service with a refused card."""
56
57 from sst.actions import *
58+from config import ENVIRONMENT
59 import actions.setup as setup_actions
60 import actions.services as services_actions
61 import actions.payment as payment_actions
62 import actions.payment_confirmed as payment_confirmed_actions
63
64+if ENVIRONMENT == 'production':
65+ skip('Can\'t test payments on production.')
66 setup_actions.setup()
67 services_actions.open()
68 services_actions.buy_music_streaming()
69
70=== modified file 'ubuntuone/web/tests/sst/shared/actions/setup.py'
71--- ubuntuone/web/tests/sst/shared/actions/setup.py 2011-11-15 06:38:57 +0000
72+++ ubuntuone/web/tests/sst/shared/actions/setup.py 2011-11-24 05:08:24 +0000
73@@ -30,7 +30,6 @@
74 import actions.header as header_actions
75 import actions.sso as sso_actions
76
77-
78 def setup(new_user=False):
79 """Create new user (optional) and log in to the Ubuntu One website.
80
81@@ -41,7 +40,7 @@
82 new_user -- Indicates if a new user has to be created for the test.
83
84 """
85- set_base_url(base_url)
86+ set_base_url(get_base_url())
87 set_wait_timeout(DEFAULT_TIMEOUT)
88 goto()
89 waitfor(title_is, 'Ubuntu One : Home')
90@@ -51,3 +50,15 @@
91 else:
92 sso_actions.login(email, password)
93 header_actions.assert_login(full_name)
94+
95+def get_base_url():
96+ base_url = None
97+ if ENVIRONMENT == 'staging':
98+ base_url = 'https://staging.one.ubuntu.com'
99+ elif ENVIRONMENT == 'edge':
100+ base_url = 'https://edge.one.ubuntu.com'
101+ elif ENVIRONMENT == 'production':
102+ base_url = 'https://one.ubuntu.com'
103+ else:
104+ skip('Unknown environment: %s.' % ENVIRONMENT)
105+ return base_url
106
107=== modified file 'ubuntuone/web/tests/sst/shared/actions/sso.py'
108--- ubuntuone/web/tests/sst/shared/actions/sso.py 2011-11-15 06:38:57 +0000
109+++ ubuntuone/web/tests/sst/shared/actions/sso.py 2011-11-24 05:08:24 +0000
110@@ -21,7 +21,7 @@
111 """Single Sign On actions for Ubuntu One."""
112
113 from sst.actions import *
114-from config import base_url
115+from setup import get_base_url
116
117 def login(email, password):
118 """Log in to Ubuntu One website.
119@@ -38,7 +38,7 @@
120 textfield_write('id_email', email)
121 textfield_write('id_password', password)
122 button_click(get_element(css_class='btn', name='continue'), wait=False)
123- waitfor(title_is, 'Authenticate to %s' % base_url)
124+ waitfor(title_is, 'Authenticate to %s' % get_base_url())
125 waitfor(get_element, tag='body')
126 button_click(get_element(css_class='btn', name='yes'))
127
128
129=== modified file 'ubuntuone/web/tests/sst/shared/config.py'
130--- ubuntuone/web/tests/sst/shared/config.py 2011-11-03 17:56:44 +0000
131+++ ubuntuone/web/tests/sst/shared/config.py 2011-11-24 05:08:24 +0000
132@@ -19,4 +19,10 @@
133 DEFAULT_TIMEOUT = 40
134
135 # set below according to need (staging v production v test instance)
136-base_url = 'https://staging.one.ubuntu.com/'
137+ENVIRONMENT = 'staging'
138+#ENVIRONMENT = 'edge'
139+#ENVIRONMENT = 'production'
140+
141+# You can overwrite the default configuration setting the variables on
142+# the file shared/_local_config.py.
143+from _localconfig import *

Subscribers

People subscribed via source and target branches