MCPcopy Create free account
hub / github.com/LaunchPlatform/beanhub-cli / test_submit_form

Function test_submit_form

tests/forms/app/test_forms.py:178–209  ·  view source on GitHub ↗
(
    tmp_path: pathlib.Path,
    make_form_doc: typing.Callable,
    settings: Settings,
    client: TestClient,
    csrf_token: str,
    make_session_cookies: MakeSessionCookies,
)

Source from the content-addressed store, hash-verified

176
177
178def test_submit_form(
179 tmp_path: pathlib.Path,
180 make_form_doc: typing.Callable,
181 settings: Settings,
182 client: TestClient,
183 csrf_token: str,
184 make_session_cookies: MakeSessionCookies,
185):
186 settings.BEANCOUNT_DIR = make_form_doc(
187 textwrap.dedent(
188 """\
189 forms:
190 - name: form0
191 fields:
192 - name: name
193 type: str
194 operations:
195 - type: append
196 file: main.bean
197 content: "; name={{ name }}"
198 """
199 )
200 )
201 resp = client.post(
202 "/form/form0",
203 data=dict(name="mock-name", csrf_token=csrf_token),
204 cookies=make_session_cookies(),
205 )
206 assert resp.status_code == 200
207
208 main_bean = tmp_path / "main.bean"
209 assert "; name=mock-name" in main_bean.read_text()

Callers

nothing calls this directly

Calls 2

make_form_docFunction · 0.85
make_session_cookiesFunction · 0.85

Tested by

no test coverage detected