Skip to content

Commit 79341b2

Browse files
committed
feat: show progress during FW upload
1 parent c93cb37 commit 79341b2

File tree

10 files changed

+353
-20
lines changed

10 files changed

+353
-20
lines changed

src/test/acceptance/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from http import HTTPStatus
12
from pathlib import Path
23

34
import pytest
@@ -91,5 +92,5 @@ def upload_test_firmware(test_client, test_fw):
9192
}
9293
rv = test_client.post('/upload', content_type='multipart/form-data', data=data, follow_redirects=True)
9394

94-
assert b'Upload Successful' in rv.data, 'upload not successful'
95+
assert rv.status_code == HTTPStatus.OK, 'upload not successful'
9596
assert test_fw.uid.encode() in rv.data, 'uid not found on upload success page'

src/test/acceptance/test_misc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
from http import HTTPStatus
23
from urllib.parse import quote
34

45
import pytest
@@ -44,7 +45,7 @@ def _upload_firmware_put(self, test_client, path, device_name, uid):
4445
'analysis_systems': [],
4546
}
4647
rv = test_client.post('/upload', content_type='multipart/form-data', data=data, follow_redirects=True)
47-
assert b'Upload Successful' in rv.data, 'upload not successful'
48+
assert rv.status_code == HTTPStatus.OK, 'upload not successful'
4849
assert uid.encode() in rv.data, 'uid not found on upload success page'
4950

5051
def _show_stats(self, test_client):

src/test/unit/web_interface/test_app_re_analyze.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import re
2+
from http import HTTPStatus
23

34
from helperFunctions.data_conversion import make_bytes
45
from test.common_helper import TEST_FW
@@ -35,7 +36,7 @@ def test_app_re_analyze_post_valid(self, test_client, intercom_task_list):
3536
'analysis_systems': ['new_system'],
3637
}
3738
rv = test_client.post(f'/update-analysis/{TEST_FW.uid}', data=form_data)
38-
assert b'Upload Successful' in rv.data
39+
assert rv.status_code == HTTPStatus.OK, 'upload not successful'
3940
assert make_bytes(TEST_FW.uid) in rv.data
4041
assert intercom_task_list[0].uid == TEST_FW.uid, 'fw not added to intercom'
4142
assert 'new_system' in intercom_task_list[0].scheduled_analysis, 'new analysis system not scheduled'

src/test/unit/web_interface/test_app_upload.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import re
2+
from http import HTTPStatus
23
from io import BytesIO
34

45

@@ -46,7 +47,7 @@ def test_app_upload_valid_firmware(self, test_client, intercom_task_list):
4647
},
4748
follow_redirects=True,
4849
)
49-
assert b'Upload Successful' in rv.data
50+
assert rv.status_code == HTTPStatus.OK, 'upload not successful'
5051
assert b'c1f95369a99b765e93c335067e77a7d91af3076d2d3d64aacd04e1e0a810b3ed_17' in rv.data
5152
assert (
5253
intercom_task_list[0].uid == 'c1f95369a99b765e93c335067e77a7d91af3076d2d3d64aacd04e1e0a810b3ed_17'

src/web_interface/components/analysis_routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def post_update_analysis(self, uid, re_do=False):
173173
raise
174174
force_reanalysis = request.form.get('force_reanalysis') == 'true'
175175
self._schedule_re_analysis_task(uid, analysis_task, re_do, force_reanalysis)
176-
return render_template('upload/upload_successful.html', uid=uid)
176+
return uid
177177

178178
def _schedule_re_analysis_task(self, uid, analysis_task, re_do, force_reanalysis=False):
179179
if re_do:

src/web_interface/components/io_routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def post_upload(self):
3535
raise
3636
fw = convert_analysis_task_to_fw_obj(analysis_task)
3737
self.intercom.add_analysis_task(fw)
38-
return render_template('upload/upload_successful.html', uid=analysis_task['uid'])
38+
return analysis_task['uid']
3939

4040
@roles_accepted(*PRIVILEGES['submit_analysis'])
4141
@AppRoute('/upload', GET)

0 commit comments

Comments
 (0)