From 2943dd42221707bd8e06e3e9e30c5b3ed9869eac Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Tue, 28 Nov 2023 14:49:37 -0500 Subject: [PATCH] test: add GPX test helpers --- terraso_backend/tests/graphql/conftest.py | 15 +++++++++++++++ terraso_backend/tests/shared_data/conftest.py | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/terraso_backend/tests/graphql/conftest.py b/terraso_backend/tests/graphql/conftest.py index 02478a8a5..92ffa15aa 100644 --- a/terraso_backend/tests/graphql/conftest.py +++ b/terraso_backend/tests/graphql/conftest.py @@ -333,6 +333,21 @@ def data_entry_kml(users, groups): ) +@pytest.fixture +def data_entry_gpx(users, groups): + creator = users[0] + creator_group = groups[0] + creator_group.members.add(creator) + return mixer.blend( + DataEntry, + created_by=creator, + size=100, + groups=creator_group, + entry_type=DataEntry.ENTRY_TYPE_FILE, + resource_type="gpx", + ) + + @pytest.fixture def data_entry_shapefile(users, groups): creator = users[0] diff --git a/terraso_backend/tests/shared_data/conftest.py b/terraso_backend/tests/shared_data/conftest.py index 910409234..4b01a4f6b 100644 --- a/terraso_backend/tests/shared_data/conftest.py +++ b/terraso_backend/tests/shared_data/conftest.py @@ -101,3 +101,19 @@ def visualization_config_kml(user): ), created_by=user, ) + + +@pytest.fixture +def visualization_config_gpx(user): + return mixer.blend( + VisualizationConfig, + size=1, + data_entry=mixer.blend( + DataEntry, + size=1, + url=f"{settings.DATA_ENTRY_FILE_BASE_URL}/{user.id}/test_data.gpx", + created_by=user, + resource_type="gpx", + ), + created_by=user, + )