Skip to content

Commit

Permalink
Add test to check no message is displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
sheonhan committed Oct 15, 2020
1 parent 7cf565e commit 78654c0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions securedrop/tests/test_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,24 @@ def test_source_session_expiration_create(config, source_app):
assert 'You were logged out due to inactivity' in text


def test_source_no_session_expiration_message_when_not_logged_in(config, source_app):
"""If sources never logged in, no message should be displayed
after SESSION_EXPIRATION_MINUTES."""

with source_app.test_client() as app:
seconds_session_expire = 1
config.SESSION_EXPIRATION_MINUTES = seconds_session_expire / 60.

resp = app.get(url_for('main.index'))
assert resp.status_code == 200

time.sleep(seconds_session_expire + 1)

refreshed_resp = app.get(url_for('main.index'), follow_redirects=True)
text = refreshed_resp.data.decode('utf-8')
assert 'You were logged out due to inactivity' not in text


def test_csrf_error_page(config, source_app):
source_app.config['WTF_CSRF_ENABLED'] = True
with source_app.test_client() as app:
Expand Down

0 comments on commit 78654c0

Please sign in to comment.