sed: -e expression #1, char 1: unknown command: `,'
===
    def test_send_substitutes_variables_before_send(self, api, db):
        # covers the pre-send pipeline end-to-end up to the real network call;
        # the call itself fails honestly without Google credentials
        aid = _seed_account(db, user_id_of(api))
        r = api.post("/test-send/send", headers=H(api),
                     json={"account_id": aid, "to_email": "dest@example.com",
                           "subject": "Invoice %RandomInvoiceNumber%",
                           "body_html": "<p>Dear %FirstName%, total %RandomTotal%.</p>",
                           "use_random_variables": True})
        assert r.status_code == 200, r.text
        d = r.json()
        assert d["ok"] is False  # no real Google creds in CI — honest failure
        assert "elapsed_ms" in d

    def test_send_csrf_and_auth(self, api, db):
        aid = _seed_account(db, user_id_of(api))
        no_csrf = api.post("/test-send/send",
                           json={"account_id": aid, "to_email": "d@x.com",
                                 "subject": "s", "body_html": "<p>x</p>"})
        assert no_csrf.status_code == 403
        from starlette.testclient import TestClient
