示例#1
0
    def setUp(self):
        self.timeout = 4
        twisted.internet.base.DelayedCall.debug = True

        conf = AutopushConfig(
            hostname="localhost",
            statsd_host=None,
        )

        # ignore logging
        logs = _TestingLogObserver()
        begin_or_register(logs)
        self.addCleanup(globalLogPublisher.removeObserver, logs)

        lb_app = EndpointHTTPFactory.for_handler(
            LBHeartbeatHandler, conf, db=None
        )
        ver_app = EndpointHTTPFactory.for_handler(
            VersionHandler, conf, db=None
        )
        self.lb_client = Client(lb_app)
        self.ver_client = Client(ver_app)
    def setUp(self):
        twisted.internet.base.DelayedCall.debug = True
        conf = AutopushConfig(
            hostname="localhost",
            statsd_host=None,
            crypto_key='AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=',
        )
        db = test_db()
        self.message_mock = db._message = Mock(spec=Message)
        self.fernet_mock = conf.fernet = Mock(spec=Fernet)

        app = EndpointHTTPFactory.for_handler(MessageHandler, conf, db=db)
        self.client = Client(app)
示例#3
0
    def setUp(self):
        twisted.internet.base.DelayedCall.debug = True

        conf = AutopushConfig(
            hostname="localhost",
            statsd_host=None,
        )

        self.logs = _TestingLogObserver()
        begin_or_register(self.logs, discardBuffer=True)
        self.addCleanup(globalLogPublisher.removeObserver, self.logs)

        app = EndpointHTTPFactory.for_handler(LogCheckHandler, conf)
        self.client = Client(app)
示例#4
0
    def setUp(self):
        from autopush.web.webpush import WebPushHandler

        self.conf = conf = AutopushConfig(
            hostname="localhost",
            statsd_host=None,
            use_cryptography=True,
        )
        self.fernet_mock = conf.fernet = Mock(spec=Fernet)

        self.db = db = test_db()
        self.message_mock = db.message = Mock(spec=Message)
        self.message_mock.all_channels.return_value = (True, [dummy_chid])

        app = EndpointHTTPFactory.for_handler(WebPushHandler, conf, db=db)
        self.wp_router_mock = app.routers["webpush"] = Mock(spec=IRouter)
        self.client = Client(app)
示例#5
0
    def setUp(self):
        self.timeout = 0.5
        twisted.internet.base.DelayedCall.debug = True

        conf = AutopushConfig(
            hostname="localhost",
            statsd_host=None,
        )

        db = DatabaseManager.from_config(conf)
        db.client = autopush.db.g_client
        db.setup_tables()

        # ignore logging
        logs = TestingLogObserver()
        begin_or_register(logs)
        self.addCleanup(globalLogPublisher.removeObserver, logs)

        app = EndpointHTTPFactory.for_handler(HealthHandler, conf, db=db)
        self.router_table = app.db.router.table
        self.message = app.db.message
        self.client = Client(app)
示例#6
0
    def setUp(self):
        self.timeout = 0.5
        twisted.internet.base.DelayedCall.debug = True

        self.mock_dynamodb2 = mock_dynamodb2()
        self.mock_dynamodb2.start()
        self.addCleanup(self.mock_dynamodb2.stop)

        settings = AutopushSettings(
            hostname="localhost",
            statsd_host=None,
        )

        # ignore logging
        logs = TestingLogObserver()
        begin_or_register(logs)
        self.addCleanup(globalLogPublisher.removeObserver, logs)

        app = EndpointHTTPFactory.for_handler(HealthHandler, settings)
        self.router_table = app.db.router.table
        self.storage_table = app.db.storage.table
        self.client = Client(app)