예제 #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')
예제 #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')
예제 #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')
예제 #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')
예제 #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')
예제 #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)
예제 #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)
예제 #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))