Esempio n. 1
0
    def test_401(self):
        app = self._create_app('hello')

        stats = Stats().init_app(app)

        pipeline = self._setup_mocks(stats)
        client = app.test_client()
        client.get('/blue/fail')

        pipeline.incr.assert_called_once_with('balls.blueprint_fail.http_401')
Esempio n. 2
0
    def test_200(self):
        app = self._create_app('hello')

        stats = Stats().init_app(app)

        pipeline = self._setup_mocks(stats)
        client = app.test_client()
        client.get('/')

        pipeline.incr.assert_called_once_with('index.http_200')
Esempio n. 3
0
    def test_302(self):
        app = self._create_app('hello')

        stats = Stats().init_app(app)

        pipeline = self._setup_mocks(stats)
        client = app.test_client()
        client.get('/blue/redirect')

        pipeline.incr.assert_called_once_with('balls.blueprint_redir.http_302')
Esempio n. 4
0
    def test_301_to_route_with_slash(self):
        app = self._create_app('hello')

        stats = Stats().init_app(app)

        pipeline = self._setup_mocks(stats)
        client = app.test_client()
        client.get('/slash')

        pipeline.incr.assert_called_once_with('None.http_301')
Esempio n. 5
0
    def test_404(self):
        app = self._create_app('hello')

        stats = Stats().init_app(app)

        pipeline = self._setup_mocks(stats)
        client = app.test_client()
        client.get('/blue/hello')

        pipeline.incr.assert_called_once_with('None.http_404')
Esempio n. 6
0
    def test_301_to_route_with_slash(self):
        app = self._create_app('hello')

        stats = Stats().init_app(app)

        pipeline = self._setup_mocks(stats)
        client = app.test_client()
        client.get('/blue/slash')

        self.assertFalse(pipeline.timing.called)
Esempio n. 7
0
    def test_404(self):
        app = self._create_app('hello')

        stats = Stats().init_app(app)

        pipeline = self._setup_mocks(stats)
        client = app.test_client()
        client.get('/hello')

        self.assertFalse(pipeline.timing.called)
Esempio n. 8
0
    def test_setup_single_application(self):
        app = self._create_app('hello')
        stats = Stats(app).client

        pipeline = self._setup_mocks(stats)
        client = app.test_client()
        client.get('/')

        self.assertTrue(pipeline.incr.called)
        pipeline.incr.assert_called_once_with('index.http_200')
        pipeline.timing.assert_called_once_with('index',
                                                TimingValue(0.03 * 1000, 10))