Add, edit and remove a company on the Watchlist, and show its reason and note in the row

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-29 19:33:57 +02:00
1 parent 17847190a0
commit fb83224007
3 files changed
+312 -73

No files matched your search

+16
View File
@@ -15,6 +15,7 @@ from fastapi.testclient import TestClient
from app.config import Config, ServerConfig
from app.main import create_app
from app.models import HAND_REASONS
from app.storage import Store
from desk.models import Item
@@ -96,6 +97,21 @@ def test_the_watchlist_is_the_third_tab_and_a_shell(client: TestClient) -> None:
assert nav.count('aria-current="page"') == 1
def test_the_watchlist_has_new_company_and_the_form_it_opens(client: TestClient) -> None:
page = client.get("/watchlist").text
assert '<button type="button" id="w-add">New company</button>' in page
assert 'id="watchlist-answer"' in page
template = page.split('<template id="company-form-template">', 1)[1].split("</template>", 1)[0]
for part in ('id="company-form"', 'id="cf-name" required', 'type="url" id="cf-url"',
'id="cf-reason"', 'id="cf-notes"', 'id="cf-cancel"', 'type="submit"'):
assert part in template, part
# The reason's options are the store's reasons, since a row's badge reads
# its words off them and a PATCH sends their values.
options = template.split('<select id="cf-reason">', 1)[1].split("</select>", 1)[0]
values = [v.split('"', 1)[0] for v in options.split('<option value="')[1:]]
assert sorted(values) == sorted(HAND_REASONS)
def test_the_read_page_of_its_own_is_gone(client: TestClient) -> None:
assert client.get("/static/role.js").status_code == 404
other = client.get("/applications").text