Skip to content

Commit

Permalink
test: Added processing test
Browse files Browse the repository at this point in the history
  • Loading branch information
josebui committed Aug 5, 2024
1 parent d4e8737 commit 67b388c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
22 changes: 22 additions & 0 deletions terraso_backend/tests/graphql/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,28 @@ def visualization_configs(users, groups):
return visualizations


@pytest.fixture
def visualization_config_processing(users, groups):
creator = users[0]
creator_group = groups[1]
creator_group.membership_list.save_membership(
creator.email, group_collaboration_roles.ROLE_MEMBER, CollaborationMembership.APPROVED
)
visualizations = mixer.cycle(5).blend(
VisualizationConfig,
created_by=creator,
data_entry=lambda: mixer.blend(
SharedResource,
target=creator_group,
source=lambda: mixer.blend(DataEntry, created_by=creator, size=100),
).source,
owner=creator_group,
mapbox_tileset_id=lambda: uuid.uuid4(),
mapbox_tileset_status=VisualizationConfig.MAPBOX_TILESET_PENDING,
)
return visualizations


@pytest.fixture
def taxonomy_terms():
return mixer.cycle(10).blend(TaxonomyTerm)
Expand Down
23 changes: 23 additions & 0 deletions terraso_backend/tests/graphql/test_visualization_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

from apps.collaboration.models import Membership as CollaborationMembership
from apps.core import group_collaboration_roles
from apps.shared_data.models import VisualizationConfig

pytestmark = pytest.mark.django_db

Expand Down Expand Up @@ -192,3 +193,25 @@ def test_visualization_configs_returns_only_for_users_groups(
assert entries_result[0] == str(visualization_config_current_user.id)
assert edges[0]["node"]["title"] == visualization_config_current_user.title
assert edges[0]["node"]["description"] == visualization_config_current_user.description


def test_visualization_configs_query_processing_status(
client_query, visualization_config_processing
):
response = client_query(
"""
{visualizationConfigs {
edges {
node {
mapboxTilesetStatus
}
}
}}
"""
)
edges = response.json()["data"]["visualizationConfigs"]["edges"]
for edge in edges:
assert (
edge["node"]["mapboxTilesetStatus"]
== VisualizationConfig.MAPBOX_TILESET_PENDING.upper()
)

0 comments on commit 67b388c

Please sign in to comment.