Coverage for src/tests/test_gis.py: 100%
32 statements
« prev ^ index » next coverage.py v7.5.0, created at 2024-12-20 18:03 +0000
« prev ^ index » next coverage.py v7.5.0, created at 2024-12-20 18:03 +0000
1import json
3import pytest
4from google.protobuf import empty_pb2
6from couchers.materialized_views import refresh_materialized_views, refresh_materialized_views_rapid
7from tests.test_communities import testing_communities # noqa
8from tests.test_fixtures import generate_user, gis_session, testconfig # noqa
11@pytest.fixture(autouse=True)
12def _(testconfig):
13 pass
16class TestGIS:
17 @staticmethod
18 def test_GetUsers(testing_communities):
19 _, token = generate_user()
21 refresh_materialized_views_rapid(None)
23 with gis_session(token) as gis:
24 http_body = gis.GetUsers(empty_pb2.Empty())
25 assert http_body.content_type == "application/json"
26 data = json.loads(http_body.data)
27 print(data)
28 assert data["type"] == "FeatureCollection"
29 assert len(data["features"]) > 1
31 @staticmethod
32 def test_GetClusteredUsers(testing_communities):
33 _, token = generate_user()
35 refresh_materialized_views(None)
37 with gis_session(token) as gis:
38 http_body = gis.GetClusteredUsers(empty_pb2.Empty())
39 assert http_body.content_type == "application/json"
40 data = json.loads(http_body.data)
41 print(data)
42 assert data["type"] == "FeatureCollection"
43 assert len(data["features"]) > 1