def test_get_decoders_parents(open_mock): """ Tests getting parent decoders """ with patch('builtins.open', open_mock): result = Decoder.get_decoders(parents=True) assert isinstance(result, dict)
def test_private_load_decoders_from_file(open_mock): """ Tests_load_decoders_from_file """ with patch('builtins.open', open_mock): result = Decoder.get_decoders() assert isinstance(result, dict)
def test_get_decoders_name(name, file_, open_mock): """Tests getting decoders by name and file filtering.""" with patch('builtins.open', open_mock): filters = {'name': name, 'file': file_} result = Decoder.get_decoders(filters=filters, search=mock_search) if name == 'agent-buffer' and file_ == 'decoders1.xml': assert result['items'][0].name == 'agent-buffer' else: assert isinstance(result, dict)
def test_get_decoders_name(name, file, open_mock): """ Tests getting decoders by name and file filtering """ with patch('builtins.open', open_mock): result = Decoder.get_decoders(name=name, search=mock_search, file=file) if name == 'agent-buffer' and file == 'decoders1.xml': assert result['items'][0].name == 'agent-buffer' else: assert isinstance(result, dict)
def test_private_load_decoders_from_file_exceptions(mock_load): """Test exceptions for load wazuh xml.""" with pytest.raises(WazuhException, match='.* 1501 .*'): Decoder.get_decoders()
def test_get_decoders_parents(open_mock): """Test getting parent decoders.""" with patch('builtins.open', open_mock): filters = {'parents': True} result = Decoder.get_decoders(filters=filters) assert isinstance(result, dict)