diff --git a/src/test/common_helper.py b/src/test/common_helper.py index 400f51adb..8bf93d494 100644 --- a/src/test/common_helper.py +++ b/src/test/common_helper.py @@ -163,6 +163,7 @@ def get_object(self, uid, analysis_filter=None): 'file_type': {'result': {'mime': 'application/octet-stream', 'full': 'test text'}}, 'mandatory_plugin': {'result': 'mandatory result'}, 'optional_plugin': {'result': 'optional result'}, + 'unloaded_plugin': {'result': 'optional result', 'plugin_version': '1.0.0'}, } return result if uid == TEST_TEXT_FILE.uid: diff --git a/src/test/unit/web_interface/test_app_show_analysis.py b/src/test/unit/web_interface/test_app_show_analysis.py index 8f2c7b4ce..f4e87d5e8 100644 --- a/src/test/unit/web_interface/test_app_show_analysis.py +++ b/src/test/unit/web_interface/test_app_show_analysis.py @@ -42,6 +42,10 @@ def get_object(self, uid, analysis_filter=None): return FAILED_FO return super().get_object(uid, analysis_filter=analysis_filter) + @staticmethod + def get_view(plugin_name): # noqa: ARG004 + return '' + @pytest.mark.WebInterfaceUnitTestConfig(intercom_mock_class=IntercomMock, database_mock_class=DbMock) class TestAppShowAnalysis: @@ -60,6 +64,10 @@ def test_app_show_analysis_get_valid_fw(self, test_client): assert b'unknown' not in result assert b'2000-01-01' in result + def test_app_not_loaded(self, test_client): + response = test_client.get(f'/analysis/{TEST_FW.uid}/unloaded_plugin/ro/{TEST_FW.uid}').data + assert b'was not loaded' in response + def test_app_show_analysis_file_with_preview(self, test_client): result = test_client.get(f'/analysis/{TEST_TEXT_FILE.uid}').data assert b'UID: ' + make_bytes(TEST_TEXT_FILE.uid) in result diff --git a/src/web_interface/templates/analysis_plugins/general_information.html b/src/web_interface/templates/analysis_plugins/general_information.html index 22f343ce2..4a75c4ae6 100644 --- a/src/web_interface/templates/analysis_plugins/general_information.html +++ b/src/web_interface/templates/analysis_plugins/general_information.html @@ -60,10 +60,15 @@ - {% set version_backend = analysis_plugin_dict[selected_analysis][3] %} {% set version_database = analysis_metadata['plugin_version'] %} + {% set version_backend = analysis_plugin_dict.get(selected_analysis, (None, None, None, None))[3] %} - {% if selected_analysis == 'unpacker' or version_database | version_is_compatible(version_backend, True) %} + {% if version_backend == None %} +