@pytest.mark.parametrize('conf, expected_return, expected_calls', [(config['purgeAgeSize'], (2, 4), {'sent_id': 0, 'size': '20', 'flag': 'purge'}), (config['purgeAge'], (1, 2), {'sent_id': 0, 'age': '72', 'flag': 'purge'}), (config['purgeSize'], (1, 2), {'sent_id': 0, 'size': '100', 'flag': 'purge'}), (config['retainAgeSize'], (2, 4), {'sent_id': 0, 'size': '20', 'flag': 'retain'}), (config['retainAge'], (1, 2), {'sent_id': 0, 'age': '72', 'flag': 'retain'}), (config['retainSize'], (1, 2), {'sent_id': 0, 'size': '100', 'flag': 'retain'})])
def test_purge_data(self, event_loop, conf, expected_return, expected_calls):
    "Test that purge_data calls Storage's purge with defined 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) as mock_storage_purge:
                with patch.object(audit, 'information', return_value=mock_audit_info()) as audit_info:
                    assert (expected_return == p.purge_data(conf))
                    assert audit_info.called
                    (args, kwargs) = mock_storage_purge.call_args
                    assert (kwargs == expected_calls)
Test that purge_data calls Storage's purge with defined configuration
@pytest.mark.parametrize('conf, expected_return, expected_calls', [(config['purgeAgeSize'], (2, 4), {'sent_id': 0, 'size': '20', 'flag': 'purge'}), (config['purgeAge'], (1, 2), {'sent_id': 0, 'age': '72', 'flag': 'purge'}), (config['purgeSize'], (1, 2), {'sent_id': 0, 'size': '100', 'flag': 'purge'}), (config['retainAgeSize'], (2, 4), {'sent_id': 0, 'size': '20', 'flag': 'retain'}), (config['retainAge'], (1, 2), {'sent_id': 0, 'age': '72', 'flag': 'retain'}), (config['retainSize'], (1, 2), {'sent_id': 0, 'size': '100', 'flag': 'retain'})])
def test_purge_data(self, event_loop, conf, expected_return, expected_calls):
    

    @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) as mock_storage_purge:
                with patch.object(audit, 'information', return_value=mock_audit_info()) as audit_info:
                    assert (expected_return == p.purge_data(conf))
                    assert audit_info.called
                    (args, kwargs) = mock_storage_purge.call_args
                    assert (kwargs == expected_calls)