def test_api_exposes_a_healthcheck(self):
        response = self.app.get("/_status")

        assert_that(response, is_ok())
        assert_that(response.headers["Content-Type"], is_("application/json"))

        entity = json.loads(response.data)
        assert_that(entity["status"], is_("ok"))
Beispiel #2
0
    def test_api_exposes_a_healthcheck(self):
        response = self.app.get("/_status")

        assert_that(response, is_ok())
        assert_that(response.headers["Content-Type"], is_("application/json"))

        entity = json.loads(response.data)
        assert_that(entity["status"], is_("ok"))
    def test__id_gets_stored(self, store):
        response = self.app.post(
            "/foo",
            data='{"_id": "foo"}',
            content_type="application/json",
            headers=[("Authorization", "Bearer foo-bearer-token")],
        )

        assert_that(response, is_ok())
        store.assert_called_with([Record({"_id": "foo"})])
Beispiel #4
0
    def test__id_gets_stored(self, store):
        response = self.app.post(
            '/foo',
            data='{"_id": "foo"}',
            content_type="application/json",
            headers=[('Authorization', 'Bearer foo-bearer-token')],
        )

        assert_that(response, is_ok())
        store.assert_called_with([Record({"_id": "foo"})])
Beispiel #5
0
    def test__id_gets_stored(self, mock_store):
        mock_store.return_value = []
        response = self.app.post(
            '/foo',
            data='{"_id": "foo"}',
            content_type="application/json",
            headers=[('Authorization', 'Bearer foo-bearer-token')],
        )

        assert_that(response, is_ok())
        mock_store.assert_called_with([{"_id": "foo"}])
    def test__id_gets_stored(self, mock_store):
        mock_store.return_value = []
        response = self.app.post(
            '/foo',
            data = '{"_id": "foo"}',
            content_type = "application/json",
            headers=[('Authorization', 'Bearer foo-bearer-token')],
        )

        assert_that(response, is_ok())
        mock_store.assert_called_with(
            [{"_id": "foo"}]
        )
Beispiel #7
0
    def test_endpoint_succeeds(self):

        data = json.dumps({
            "_start_at": "2014-12-17T00:00:00Z",
        })

        response = self.app.post(
            '/data/some-group/some-type/transform',
            data=data,
            content_type='application/json',
            headers=[('Authorization', 'Bearer foo-bearer-token')],
        )
        assert_that(response, is_ok())
 def test_that_querying_for_more_than_7_days_is_valid(self):
     response = self.app.get("/foo?group_by=pie"
                             "&start_at=2013-04-01T00:00:00Z"
                             "&end_at=2013-04-08T00:00:00Z")
     assert_that(response, is_ok())
 def test_that_queries_with_group_by_are_allowed(self):
     response = self.app.get("/bar?filter_by=foo:bar&group_by=pie")
     assert_that(response, is_ok())
Beispiel #10
0
 def test_that_querying_for_more_than_7_days_is_valid(self):
     response = self.app.get("/foo?group_by=pie"
                             "&start_at=2013-04-01T00:00:00Z"
                             "&end_at=2013-04-08T00:00:00Z")
     assert_that(response, is_ok())
Beispiel #11
0
 def test_that_queries_with_group_by_are_allowed(self):
     response = self.app.get("/bar?filter_by=foo:bar&group_by=pie")
     assert_that(response, is_ok())