This repository has been archived by the owner on Oct 1, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reorg tests, add some selenium tests
- Loading branch information
Showing
12 changed files
with
108 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,3 +70,7 @@ target/ | |
# | ||
.idea/* | ||
.c9/ | ||
|
||
.testmondata | ||
.tmontmp/ | ||
.coverage* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import pytest | ||
|
||
|
||
@pytest.mark.django_db | ||
class TestLogin: | ||
@pytest.mark.parametrize("uri", [ | ||
'/', | ||
'/send/adhoc/', | ||
'/send/group/', | ||
'/group/all/', | ||
'/group/new/', | ||
'/group/edit/1/', | ||
'/recipient/all/', | ||
'/recipient/new/', | ||
'/recipient/edit/1/', | ||
'/keyword/all/', | ||
'/keyword/new/', | ||
'/keyword/edit/1/', | ||
'/keyword/responses/1/', | ||
'/keyword/responses/1/archive/', | ||
'/keyword/responses/csv/1/', | ||
'/incoming/', | ||
'/outgoing/', | ||
'/incoming/curate_wall/', | ||
'/incoming/curate_wall/', | ||
]) | ||
def test_not_logged_in(self, uri, live_server, browser, users): | ||
browser.get(live_server + uri) | ||
assert len(browser.find_elements_by_name('login')) == 1 | ||
assert len(browser.find_elements_by_name('password')) == 1 | ||
assert len(browser.find_elements_by_name('remember')) == 1 | ||
|
||
@pytest.mark.parametrize("uri", [ | ||
'/', | ||
'/send/adhoc/', | ||
'/send/group/', | ||
'/group/all/', | ||
'/group/new/', | ||
'/group/edit/1/', | ||
'/recipient/all/', | ||
'/recipient/new/', | ||
'/recipient/edit/1/', | ||
'/keyword/all/', | ||
'/keyword/new/', | ||
'/keyword/edit/1/', | ||
'/keyword/responses/1/', | ||
'/keyword/responses/1/archive/', | ||
'/keyword/responses/csv/1/', | ||
'/incoming/', | ||
'/outgoing/', | ||
'/incoming/curate_wall/', | ||
'/incoming/curate_wall/', | ||
]) | ||
def test_log_in(self, uri, live_server, browser, users): | ||
# login | ||
browser.get(live_server + uri) | ||
email_box = browser.find_elements_by_name('login')[0] | ||
email_box.send_keys(users['staff'].email) | ||
password_box = browser.find_elements_by_name('password')[0] | ||
password_box.send_keys('top_secret') | ||
login_button = browser.find_elements_by_xpath('html/body/div/div/div/form/button')[0] | ||
login_button.click() | ||
# check we have been redirected | ||
assert live_server + uri in browser.current_url | ||
|
||
# log out again | ||
browser.get(live_server + '/accounts/logout') | ||
logout_confirm = browser.find_elements_by_xpath('html/body/div/div/div/form/button')[0] | ||
logout_confirm.click() | ||
assert 'accounts/login' in browser.current_url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters