Esempio n. 1
0
def test_db(metrics=None):
    """Return a test DatabaseManager: its Storage/Router are mocked"""
    return DatabaseManager(
        storage=Mock(spec=Storage),
        router=Mock(spec=Router),
        metrics=SinkMetrics() if metrics is None else metrics
    )
Esempio n. 2
0
def test_db(metrics=None):
    """Return a test DatabaseManager: its Storage/Router are mocked"""
    return DatabaseManager(
        router_conf=DDBTableConfig(tablename='router'),
        router=Mock(spec=Router),
        message_conf=DDBTableConfig(tablename='message'),
        metrics=SinkMetrics() if metrics is None else metrics)
Esempio n. 3
0
 def test_init_with_resources(self):
     from autopush.db import DynamoDBResource
     dm = DatabaseManager(router_conf=Mock(),
                          message_conf=Mock(),
                          metrics=Mock(),
                          resource=None)
     assert dm.resource is not None
     assert isinstance(dm.resource, DynamoDBResource)