diff options
| author | stuppie | 2026-11-04 12:11:03 -0600 |
|---|---|---|
| committer | stuppie | 2026-11-04 12:11:03 -0600 |
| commit | 671a7b1b02503cfa5c9aecd40c27a0c2729a285b (patch) | |
| tree | 6cb1bd7c33e3e1d243ee5ae74decc57faaa5742d /tests/http/test_preview.py | |
| parent | e99ec6b7e38113a2237dc1ff402d8f4337c651d5 (diff) | |
| download | amt-jb-671a7b1b02503cfa5c9aecd40c27a0c2729a285b.tar.gz amt-jb-671a7b1b02503cfa5c9aecd40c27a0c2729a285b.zip | |
strip out AMT
Diffstat (limited to 'tests/http/test_preview.py')
| -rw-r--r-- | tests/http/test_preview.py | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/tests/http/test_preview.py b/tests/http/test_preview.py deleted file mode 100644 index 39a6f5b..0000000 --- a/tests/http/test_preview.py +++ /dev/null @@ -1,71 +0,0 @@ -# There are two types of "preview" - one is where we navigate direclty -# to it and one is where we redirect possibly - -import pytest -from httpx import AsyncClient - -from jb.models.assignment import AssignmentStub -from jb.models.hit import Hit - - -class TestPreview: - - @pytest.mark.anyio - async def test_preview_direct(self, httpxclient: AsyncClient): - client = httpxclient - res = await client.get("/preview/") - - assert res.status_code == 200 - assert res.headers["content-type"] == "text/html; charset=utf-8" - assert res.num_bytes_downloaded == 507 - - assert "James Billings loves you." in res.text - assert "https://cdn.jamesbillings67.com/james-has-style.css" in res.text - assert "https://cdn.jamesbillings67.com/james-billings.js" in res.text - - @pytest.mark.anyio - async def test_preview_redirect_from_work_random_str( - self, httpxclient: AsyncClient, amt_hit_id: str, amt_assignment_id: str - ): - client = httpxclient - - """ - The redirect occurs regardless of any parameter validation. This is - because the query params will be used for record lookup on the work - page itself. - """ - - params = { - "workerId": None, - "assignmentId": amt_assignment_id, - "hitId": amt_hit_id, - } - res = await client.get("/work/", params=params) - - assert res.status_code == 302 - assert "/preview/" in res.headers["location"] - - @pytest.mark.anyio - async def test_preview_redirect_from_work_records( - self, - httpxclient: AsyncClient, - hit_record: Hit, - assignment_stub_record: AssignmentStub, - ): - client = httpxclient - - """ - The redirect occurs regardless of any parameter validation. This is - because the query params will be used for record lookup on the work - page itself. - """ - - params = { - "workerId": None, - "assignmentId": assignment_stub_record.amt_assignment_id, - "hitId": hit_record.amt_hit_id, - } - res = await client.get("/work/", params=params) - - assert res.status_code == 302 - assert "/preview/" in res.headers["location"] |
