mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 10:53:28 -05:00
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
This commit is contained in:
@@ -16,9 +16,12 @@ def test_should_return_list_of_all_jobs(notifications_admin, notifications_admin
|
||||
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:
|
||||
user = create_test_user('active')
|
||||
client.login(user)
|
||||
response = client.get('/services/123/jobs/456')
|
||||
# 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)
|
||||
|
||||
@@ -2,15 +2,22 @@ from io import BytesIO
|
||||
from tests.app.main import create_test_user
|
||||
|
||||
|
||||
def teardown_function(function):
|
||||
import glob
|
||||
import os
|
||||
files = glob.glob("/tmp/*.csv")
|
||||
for f in files:
|
||||
os.remove(f)
|
||||
|
||||
|
||||
def test_upload_empty_csvfile_returns_to_upload_page(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)
|
||||
|
||||
upload_data = {'file': (BytesIO(''.encode('utf-8')), 'emtpy.csv')}
|
||||
response = client.post('/services/123/sms/send', data=upload_data,
|
||||
follow_redirects=True)
|
||||
response = client.post('/services/123/sms/send',
|
||||
data=upload_data, follow_redirects=True)
|
||||
|
||||
assert response.status_code == 200
|
||||
content = response.get_data(as_text=True)
|
||||
|
||||
Reference in New Issue
Block a user