Spaces:
Sleeping
Sleeping
rmm
commited on
Commit
·
f14dad2
1
Parent(s):
13a80d6
test: main full workflow test populates email unless debug mode
Browse files- test simulates user filling in the email, and passes correctly.
- if the debug mode is set, it doesn't bother as the field is
autopopulated.
- tests/test_main.py +5 -2
tests/test_main.py
CHANGED
@@ -3,7 +3,7 @@ from unittest.mock import MagicMock, patch
|
|
3 |
from streamlit.testing.v1 import AppTest
|
4 |
import time
|
5 |
|
6 |
-
from input.input_handling import spoof_metadata
|
7 |
from input.input_observation import InputObservation
|
8 |
from input.input_handling import buffer_uploaded_files
|
9 |
|
@@ -72,7 +72,10 @@ def test_click_validate_after_data_entry(mock_file_rv: MagicMock, mock_uploadedF
|
|
72 |
assert infer_button.disabled == True
|
73 |
|
74 |
|
75 |
-
# 2. upload files, and trigger the callback
|
|
|
|
|
|
|
76 |
|
77 |
# put the mocked file_upload into session state, as if it were the result of a file upload, with the key 'file_uploader_data'
|
78 |
at.session_state["file_uploader_data"] = mock_files
|
|
|
3 |
from streamlit.testing.v1 import AppTest
|
4 |
import time
|
5 |
|
6 |
+
from input.input_handling import spoof_metadata, load_debug_autopopulate
|
7 |
from input.input_observation import InputObservation
|
8 |
from input.input_handling import buffer_uploaded_files
|
9 |
|
|
|
72 |
assert infer_button.disabled == True
|
73 |
|
74 |
|
75 |
+
# 2. upload files, enter email, and trigger the callback
|
76 |
+
if not load_debug_autopopulate():
|
77 |
+
# fill the text box with a dummy email
|
78 |
+
at.session_state.input_author_email = "[email protected]"
|
79 |
|
80 |
# put the mocked file_upload into session state, as if it were the result of a file upload, with the key 'file_uploader_data'
|
81 |
at.session_state["file_uploader_data"] = mock_files
|