From 93f2231a8126d711ec9c219371265ef0f1d1b80f Mon Sep 17 00:00:00 2001 From: mschwoerer <82171591+mschwoer@users.noreply.github.com> Date: Tue, 10 Sep 2024 08:17:56 +0200 Subject: [PATCH] fix tests --- tests/gui/test_02_import_data.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/gui/test_02_import_data.py b/tests/gui/test_02_import_data.py index d37dabd5..2f5587e0 100644 --- a/tests/gui/test_02_import_data.py +++ b/tests/gui/test_02_import_data.py @@ -1,3 +1,5 @@ +import uuid + from streamlit.testing.v1 import AppTest from pathlib import Path from unittest.mock import MagicMock, patch @@ -16,6 +18,14 @@ def print_session_state(apptest: AppTest): TEST_INPUT_FILES = f"{APP_FOLDER}/../../testfiles" +def _is_valid_uuid(value: str) -> bool: + try: + uuid.UUID(str(value)) + return True + except ValueError: + return False + + def test_page_02_loads_without_input(): """Test if the page loads without any input and inititalizes the session state with the correct values.""" at = AppTest(APP_FILE, default_timeout=200) @@ -24,7 +34,7 @@ def test_page_02_loads_without_input(): assert not at.exception assert at.session_state.organism == 9606 - assert at.session_state.user_session_id == "test session id" + assert at.session_state.user_session_id is not None assert at.session_state.gene_to_prot_id == {} @@ -37,7 +47,7 @@ def test_patched_page_02_loads_without_input(mock_file_uploader: MagicMock): assert not at.exception assert at.session_state.organism == 9606 - assert at.session_state.user_session_id == "test session id" + assert at.session_state.user_session_id is not None assert at.session_state.gene_to_prot_id == {}