Skip to content

Test that the add_blurb form renders - #477

Merged
Mariatta merged 1 commit into
python:mainfrom
Mariatta:test-add-blurb-form
Oct 22, 2026
Merged

Mariatta merged 1 commit into
python:mainfrom
Mariatta:test-add-blurb-form

Conversation

@Mariatta

@Mariatta Mariatta commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

No test requested GET /add_blurb, so a template error or a broken inline script in the form would pass CI. That nearly happened while rebasing #475: a conflict resolution truncated the CVE toggle script, and only a manual check caught it.

This adds a test that signs in through the session, stubs the GitHub App lookups, and checks that the page renders with every field the POST handler reads, the Security option, and the ids the CVE toggle script relies on. Two more tests cover the redirects around it: an anonymous request to the form goes home, and a signed-in request to the home page goes to the form.

The redirect test showed that the handlers return web.HTTPFound(...) instead of raising it. aiohttp deprecates returning exception objects, and the suite's warnings-as-errors setting turned that into a server error in the test. All six redirects now raise, which is also what error_middleware documents as the expected path. Behaviour for users is unchanged.

Coverage of blurb_it/__main__.py goes from 34% to 46%.

@Mariatta
Mariatta force-pushed the test-add-blurb-form branch 2 times, most recently from 46fb89a to 61ee440 Compare October 22, 2026 00:48
No test requested GET /add_blurb, so a template error or a broken
inline script in the form would pass CI. Add a test that signs in
through the session, stubs the GitHub App lookups, and checks that the
page renders with every field the POST handler reads, the Security
option, and the hooks the CVE toggle script relies on. Also test the
two redirects around it: an anonymous request to the form goes home,
and a signed-in request to the home page goes to the form.

The redirect tests showed that the handlers return HTTPFound instead
of raising it, which aiohttp deprecates and which the suite's
warnings-as-errors setting turns into a server error. Raise all six
redirects instead, which is also what the error middleware expects.
@Mariatta
Mariatta force-pushed the test-add-blurb-form branch from 61ee440 to 2faa118 Compare October 22, 2026 00:50
@Mariatta
Mariatta merged commit fdfe2e4 into python:main Oct 22, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant