        assert r5.status_code == 200
        assert all(s["id"] != sid for s in api.get("/subjects/list").json()["subjects"])

    def test_empty_subject_rejected(self, api):
        r = api.post("/subjects", headers=H(api), json={"subject": ""})
        assert r.status_code in (400, 422)

    def test_search(self, api):
        api.post("/subjects", headers=H(api), json={"subject": "Invoice reminder alpha"})
        api.post("/subjects", headers=H(api), json={"subject": "Payment due beta"})
        d = api.get("/subjects/list?q=alpha").json()
        assert d["total"] == 1
        assert d["subjects"][0]["subject"] == "Invoice reminder alpha"

