dnscms: remove some wordpress import functionality, keep fields around but defer
This commit is contained in:
@@ -248,6 +248,22 @@ def test_future_events_does_not_have_n_plus_one_queries(
|
||||
)
|
||||
|
||||
|
||||
def test_future_events_does_not_load_wp_import_fields(event_index, graphql_post):
|
||||
"""wp_* columns must stay deferred and lazy-load on explicit access."""
|
||||
event = EventPageFactory(parent=event_index, wp_raw_content="marker")
|
||||
EventOccurrence.objects.create(
|
||||
event=event, start=timezone.now() + timedelta(days=1), venue_custom="X"
|
||||
)
|
||||
|
||||
with CaptureQueriesContext(connection) as ctx:
|
||||
response, body = graphql_post("{ eventIndex { futureEvents { id } } }")
|
||||
|
||||
assert response.status_code == 200 and "errors" not in body, body
|
||||
sql = "\n".join(q["sql"] for q in ctx.captured_queries)
|
||||
assert "wp_raw_content" not in sql, f"wp_* must be deferred. SQL:\n{sql}"
|
||||
assert EventPage.objects.get(pk=event.pk).wp_raw_content == "marker"
|
||||
|
||||
|
||||
def test_graphql_event_index_future_events_ordered_by_next_occurrence(event_index, graphql_post):
|
||||
now = timezone.now()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user