Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/test/common_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions src/test/unit/web_interface/test_app_show_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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'<strong>UID:</strong> ' + make_bytes(TEST_TEXT_FILE.uid) in result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,15 @@
</td>
</tr>

{% 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 %}
<tr>
<td class="table-danger">Plugin not found</td>
<td>The analysis plugin that belongs to this analysis result was not loaded, so the result cannot be rendered.</td>
</tr>
{% elif selected_analysis == 'unpacker' or version_database | version_is_compatible(version_backend, True) %}
{% if analysis_result is not none and 'skipped' not in analysis_result %}
{% block analysis_result_details %}

Expand Down