def test_get_decoders_files_filters(status, relative_dirname, filename, expected_files): # UUT call result = decoder.get_decoders_files(status=status, relative_dirname=relative_dirname, filename=filename) assert isinstance(result, AffectedItemsWazuhResult) # Build result_files set from response for filter validation result_files = {d['filename'] for d in result.affected_items} assert result_files == expected_files
def test_get_decoders_files(conf, exception): with patch('wazuh.core.configuration.get_ossec_conf', return_value=conf): try: # UUT call result = decoder.get_decoders_files() assert isinstance(result, AffectedItemsWazuhResult) # Assert result is a list with at least one dict element with the appropriate fields assert isinstance(result.affected_items, list) assert len(result.affected_items) != 0 for item in result.affected_items: assert {'filename', 'relative_dirname', 'status'}.issubset(set(item)) assert result.total_affected_items == len(result.affected_items) except WazuhInternalError as e: # If the UUT call returns an exception we check it has the appropriate error code assert e.code == exception.code