mirror of
https://github.com/zvx-echo6/central.git
synced 2026-05-21 18:14:44 +02:00
test: add real assertions to since/until and region filter tests
Replace trivial status_code==200 assertions with checks that verify the filter values were actually parsed and passed to the template. These tests now fail if the handler ignores the filter parameters.
This commit is contained in:
parent
c91cd10519
commit
1b404d02b5
1 changed files with 14 additions and 0 deletions
|
|
@ -147,6 +147,12 @@ class TestEventsFeedFrontendAuthenticated:
|
||||||
result = await events_list(mock_request)
|
result = await events_list(mock_request)
|
||||||
|
|
||||||
assert result.status_code == 200
|
assert result.status_code == 200
|
||||||
|
# Verify filter was actually parsed and passed to template
|
||||||
|
mock_templates.TemplateResponse.assert_called_once()
|
||||||
|
call_kwargs = mock_templates.TemplateResponse.call_args.kwargs
|
||||||
|
context = call_kwargs.get("context", call_kwargs)
|
||||||
|
assert context["filter_values"]["since"] == "2026-05-17T00:00:00"
|
||||||
|
assert context["filter_values"]["until"] == "2026-05-17T12:00:00"
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_events_region_filter(self):
|
async def test_events_region_filter(self):
|
||||||
|
|
@ -194,6 +200,14 @@ class TestEventsFeedFrontendAuthenticated:
|
||||||
result = await events_list(mock_request)
|
result = await events_list(mock_request)
|
||||||
|
|
||||||
assert result.status_code == 200
|
assert result.status_code == 200
|
||||||
|
# Verify region filter was actually parsed and passed to template
|
||||||
|
mock_templates.TemplateResponse.assert_called_once()
|
||||||
|
call_kwargs = mock_templates.TemplateResponse.call_args.kwargs
|
||||||
|
context = call_kwargs.get("context", call_kwargs)
|
||||||
|
assert context["filter_values"]["region_north"] == "49.5"
|
||||||
|
assert context["filter_values"]["region_south"] == "31"
|
||||||
|
assert context["filter_values"]["region_east"] == "-102"
|
||||||
|
assert context["filter_values"]["region_west"] == "-124.5"
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_events_partial_region_shows_error_banner(self):
|
async def test_events_partial_region_shows_error_banner(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue