Merge lp:~matiasb/canonical-identity-provider/adding-2fa-acceptance-tests into lp:canonical-identity-provider/release

Proposed by Matias Bordese
Status: Merged
Approved by: Natalia Bidart
Approved revision: no longer in the source branch.
Merged at revision: 529
Proposed branch: lp:~matiasb/canonical-identity-provider/adding-2fa-acceptance-tests
Merge into: lp:canonical-identity-provider/release
Diff against target: 91 lines (+74/-0)
3 files modified
identityprovider/tests/acceptance/shared/actions/subheader.py (+47/-0)
identityprovider/tests/acceptance/shared/actions/two_factor.py (+5/-0)
identityprovider/tests/acceptance/two_factor/check_username_display.py (+22/-0)
To merge this branch: bzr merge lp:~matiasb/canonical-identity-provider/adding-2fa-acceptance-tests
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Leo Arias (community) code review Approve
Review via email: mp+132619@code.launchpad.net

Commit message

Added acceptance tests for two factor page.

Description of the change

Added acceptance tests for two factor page (username display, logout option).
Started work on acceptance actions framework/refactoring.

To post a comment you must log in.
Revision history for this message
Leo Arias (elopio) wrote :

we are trying to get rid of this:
59 +from sst.actions import *
so you can either import sst.actions and then call sst.actions.go_to
or from sst.actions import go_to.

thank you.

review: Approve (code review)
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

It looks great!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'identityprovider/tests/acceptance/shared/actions'
2=== added file 'identityprovider/tests/acceptance/shared/actions/__init__.py'
3=== added file 'identityprovider/tests/acceptance/shared/actions/subheader.py'
4--- identityprovider/tests/acceptance/shared/actions/subheader.py 1970-01-01 00:00:00 +0000
5+++ identityprovider/tests/acceptance/shared/actions/subheader.py 2012-11-01 21:04:21 +0000
6@@ -0,0 +1,47 @@
7+import sst.actions
8+
9+
10+def _assert_full_name_in_account_link(full_name):
11+ sst.actions.assert_text(_get_my_account_link(), full_name[:40])
12+
13+
14+def _get_my_account_link():
15+ return sst.actions.get_element(id='account-link')
16+
17+
18+def _get_devices_link():
19+ return sst.actions.get_element(id='devices-link')
20+
21+
22+def _get_applications_link():
23+ return sst.actions.get_element(id='applications-link')
24+
25+
26+def _get_log_out_link():
27+ return sst.actions.get_element(id='logout-link')
28+
29+
30+def assert_log_in(full_name):
31+ _assert_full_name_in_account_link(full_name)
32+ _get_log_out_link()
33+
34+
35+def assert_log_out():
36+ sst.actions.fails(_get_my_account_link)
37+ sst.actions.fails(_get_log_out_link)
38+
39+
40+def go_to_account():
41+ sst.actions.click_link(_get_my_account_link())
42+
43+
44+def go_to_devices():
45+ sst.actions.click_link(_get_devices_link())
46+
47+
48+def go_to_applications():
49+ sst.actions.click_link(_get_applications_link())
50+
51+
52+def log_out():
53+ sst.actions.click_link(_get_log_out_link())
54
55=== added file 'identityprovider/tests/acceptance/shared/actions/two_factor.py'
56--- identityprovider/tests/acceptance/shared/actions/two_factor.py 1970-01-01 00:00:00 +0000
57+++ identityprovider/tests/acceptance/shared/actions/two_factor.py 2012-11-01 21:04:21 +0000
58@@ -0,0 +1,5 @@
59+import sst.actions
60+
61+
62+def open_page():
63+ sst.actions.go_to('/two_factor_auth')
64
65=== added directory 'identityprovider/tests/acceptance/two_factor'
66=== added file 'identityprovider/tests/acceptance/two_factor/check_username_display.py'
67--- identityprovider/tests/acceptance/two_factor/check_username_display.py 1970-01-01 00:00:00 +0000
68+++ identityprovider/tests/acceptance/two_factor/check_username_display.py 2012-11-01 21:04:21 +0000
69@@ -0,0 +1,22 @@
70+# Check two factor page displays the username, account and logout options.
71+
72+from u1testutils.sst import config
73+
74+import helpers
75+
76+from actions import (
77+ subheader,
78+ two_factor,
79+)
80+
81+
82+config.set_base_url_from_env()
83+
84+display_name = "Fred Jones"
85+# Create an account and login.
86+helpers.register_account(displayname=display_name)
87+
88+# Go to two factor auth page
89+two_factor.open_page()
90+# check subheader navbar displays user info
91+subheader.assert_log_in(display_name)