2016-01-11 16:03:41 +00:00
|
|
|
from tests.app.main import create_test_user
|
2015-12-17 16:21:34 +00:00
|
|
|
|
|
|
|
|
|
2016-01-15 15:15:35 +00:00
|
|
|
def test_should_return_list_of_all_jobs(app_, db_, db_session):
|
|
|
|
|
with app_.test_request_context():
|
|
|
|
|
with app_.test_client() as client:
|
2016-01-11 16:03:41 +00:00
|
|
|
user = create_test_user('active')
|
|
|
|
|
client.login(user)
|
2016-01-13 13:14:23 +00:00
|
|
|
response = client.get('/services/123/jobs')
|
2015-12-17 16:21:34 +00:00
|
|
|
|
2016-01-11 16:03:41 +00:00
|
|
|
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)
|
2015-12-17 16:21:34 +00:00
|
|
|
|
|
|
|
|
|
2016-01-15 15:15:35 +00:00
|
|
|
def test_should_show_page_for_one_job(app_, db_, db_session):
|
|
|
|
|
with app_.test_request_context():
|
|
|
|
|
with app_.test_client() as client:
|
2016-01-13 17:32:40 +00:00
|
|
|
# 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')
|
2015-12-17 16:21:34 +00:00
|
|
|
|
2016-01-11 16:03:41 +00:00
|
|
|
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)
|
2015-12-17 16:21:34 +00:00
|
|
|
|
2016-01-11 16:03:41 +00:00
|
|
|
|
2016-01-15 15:15:35 +00:00
|
|
|
def test_should_show_page_for_one_notification(app_, db_, db_session):
|
|
|
|
|
with app_.test_request_context():
|
|
|
|
|
with app_.test_client() as client:
|
2016-01-11 16:03:41 +00:00
|
|
|
user = create_test_user('active')
|
|
|
|
|
client.login(user)
|
2016-01-13 13:14:23 +00:00
|
|
|
response = client.get('/services/123/jobs/456/notification/3')
|
2016-01-11 16:03:41 +00:00
|
|
|
|
|
|
|
|
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)
|