Files
notifications-admin/tests/app/main/views/test_jobs.py
Adam Shimali 4dcb180da1 Changed page flow to first save file and then redirect to check.
On check numbers in file are validated.

Posting to check then uploads file to s3
2016-01-13 17:32:40 +00:00

41 lines
1.8 KiB
Python

from tests.app.main import create_test_user
def test_should_return_list_of_all_jobs(notifications_admin, notifications_admin_db, notify_db_session):
with notifications_admin.test_request_context():
with notifications_admin.test_client() as client:
user = create_test_user('active')
client.login(user)
response = client.get('/services/123/jobs')
assert response.status_code == 200
assert 'Test message 1' in response.get_data(as_text=True)
assert 'Final reminder' in response.get_data(as_text=True)
def test_should_show_page_for_one_job(notifications_admin, notifications_admin_db, notify_db_session):
with notifications_admin.test_request_context():
with notifications_admin.test_client() as client:
# TODO filename will be part of job metadata not in session
with client.session_transaction() as s:
s[456] = 'dispatch_20151114.csv'
user = create_test_user('active')
client.login(user)
response = client.get('/services/123/jobs/456')
assert response.status_code == 200
assert 'dispatch_20151114.csv' in response.get_data(as_text=True)
assert 'Test message 1' in response.get_data(as_text=True)
def test_should_show_page_for_one_notification(notifications_admin, notifications_admin_db, notify_db_session):
with notifications_admin.test_request_context():
with notifications_admin.test_client() as client:
user = create_test_user('active')
client.login(user)
response = client.get('/services/123/jobs/456/notification/3')
assert response.status_code == 200
assert 'Text message' in response.get_data(as_text=True)
assert '+44 7700 900 522' in response.get_data(as_text=True)