File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,9 @@ def start_download(workgroup):
6868
6969 if form .validate_on_submit ():
7070 if form .data_type .data == DataTypeForm .CHILD_RECORDS :
71- return redirect (mavis_helper .mavis_public_url (current_app , "/programmes" ))
71+ return redirect (
72+ mavis_helper .mavis_public_url (current_app , "/vaccination-report/new" )
73+ )
7274 elif form .data_type .data == DataTypeForm .AGGREGATE_DATA :
7375 raise ValueError ("Invalid data type" )
7476 # return redirect(url_for("main.download", workgroup=team.workgroup))
Original file line number Diff line number Diff line change 1+ from http import HTTPStatus
2+
3+ from mavis .reporting .forms .data_type_form import DataTypeForm
4+ from mavis .reporting .helpers import auth_helper , mavis_helper
5+ from tests .helpers import mock_user_info
6+
7+
8+ def test_start_download_redirects_to_new_child_record_form (app , client ):
9+ app .config ["ROOT_URL" ] = "http://mavis.test/reports/"
10+ app .config ["WTF_CSRF_ENABLED" ] = False
11+
12+ with app .app_context ():
13+ with client .session_transaction () as session :
14+ auth_helper .log_user_in (mock_user_info (), session )
15+
16+ response = client .post (
17+ "/reports/team/r1l/start-download" ,
18+ data = {"data_type" : DataTypeForm .CHILD_RECORDS },
19+ follow_redirects = False ,
20+ )
21+
22+ expected_location = mavis_helper .mavis_public_url (
23+ app , "/vaccination-report/new"
24+ )
25+
26+ assert response .status_code == HTTPStatus .FOUND
27+ assert response .headers ["Location" ] == expected_location
You can’t perform that action at this time.
0 commit comments