@pytest.mark.parametrize('conf, expected_error_key', [({'retainUnsent': {'value': 'True'}, 'age': {'value': 'bla'}, 'size': {'value': '0'}}, 'age'), ({'retainUnsent': {'value': 'True'}, 'age': {'value': '0'}, 'size': {'value': 'bla'}}, 'size')])
def test_purge_data_invalid_conf(self, event_loop, conf, expected_error_key):
    'Test that purge_data raises exception when called with invalid configuration'

    @asyncio.coroutine
    def mock_audit_info():
        return ''
    mockStorageClient = MagicMock(spec=StorageClient)
    mockAuditLogger = AuditLogger(mockStorageClient)
    with patch.object(FoglampProcess, '__init__'):
        with patch.object(mockAuditLogger, '__init__', return_value=None):
            p = Purge(loop=event_loop)
            p._logger = logger
            p._logger.info = MagicMock()
            p._logger.error = MagicMock()
            p._storage = MagicMock(spec=StorageClient)
            p._readings_storage = MagicMock(spec=ReadingsStorageClient)
            audit = p._audit
            with patch.object(p._readings_storage, 'purge', side_effect=self.store_purge):
                with patch.object(audit, 'information', return_value=mock_audit_info()):
                    p.purge_data(conf)
                    p._logger.error.assert_called_with('Configuration item {} bla should be integer!'.format(expected_error_key))
Test that purge_data raises exception when called with invalid configuration
@pytest.mark.parametrize('conf, expected_error_key', [({'retainUnsent': {'value': 'True'}, 'age': {'value': 'bla'}, 'size': {'value': '0'}}, 'age'), ({'retainUnsent': {'value': 'True'}, 'age': {'value': '0'}, 'size': {'value': 'bla'}}, 'size')])
def test_purge_data_invalid_conf(self, event_loop, conf, expected_error_key):
    

    @asyncio.coroutine
    def mock_audit_info():
        return 
    mockStorageClient = MagicMock(spec=StorageClient)
    mockAuditLogger = AuditLogger(mockStorageClient)
    with patch.object(FoglampProcess, '__init__'):
        with patch.object(mockAuditLogger, '__init__', return_value=None):
            p = Purge(loop=event_loop)
            p._logger = logger
            p._logger.info = MagicMock()
            p._logger.error = MagicMock()
            p._storage = MagicMock(spec=StorageClient)
            p._readings_storage = MagicMock(spec=ReadingsStorageClient)
            audit = p._audit
            with patch.object(p._readings_storage, 'purge', side_effect=self.store_purge):
                with patch.object(audit, 'information', return_value=mock_audit_info()):
                    p.purge_data(conf)
                    p._logger.error.assert_called_with('Configuration item {} bla should be integer!'.format(expected_error_key))