dnscms: add more tests

This commit is contained in:
2026-05-19 04:42:27 +02:00
parent f7e0200a0a
commit 843062bb13
6 changed files with 565 additions and 50 deletions
-32
View File
@@ -1,38 +1,6 @@
from datetime import timedelta
from django.utils import timezone
from events.models import EventOccurrence
from tests.conftest import EventPageFactory
def test_graphql_endpoint_responds(db, graphql_post):
response, body = graphql_post("{ __schema { queryType { name } } }")
assert response.status_code == 200
assert "errors" not in body
assert body["data"]["__schema"]["queryType"]["name"] == "Query"
def test_event_index_future_events_query(event_index, graphql_post):
upcoming = EventPageFactory(parent=event_index, title="Upcoming gig")
EventOccurrence.objects.create(
event=upcoming,
start=timezone.now() + timedelta(days=3),
venue_custom="Storsalen",
)
response, body = graphql_post(
"""
query {
eventIndex {
futureEvents { title }
}
}
"""
)
assert response.status_code == 200
assert "errors" not in body, body
titles = [e["title"] for e in body["data"]["eventIndex"]["futureEvents"]]
assert "Upcoming gig" in titles