Exemplo n.º 1
0
    def setUp(self):
        self.timeout = 0.5
        twisted.internet.base.DelayedCall.debug = True

        self.log_mock = patch("autopush.health.log").start()
        self.mock_dynamodb2 = mock_dynamodb2()
        self.mock_dynamodb2.start()

        HealthHandler.ap_settings = self.settings = AutopushSettings(
            hostname="localhost",
            statsd_host=None,
        )
        self.router_table = self.settings.router.table
        self.storage_table = self.settings.storage.table

        self.request_mock = Mock()
        self.health = HealthHandler(Application(), self.request_mock)
        self.status_mock = self.health.set_status = Mock()
        self.write_mock = self.health.write = Mock()

        d = self.finish_deferred = Deferred()
        self.health.finish = lambda: d.callback(True)