Add basic posting to the e2e test.

Co-authored-by: Inire <>
This commit is contained in:
FatherInire 2022-05-22 12:39:54 +10:00 committed by GitHub
parent d0c9a6b2d7
commit 31cb9e049f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,7 +10,8 @@ def test_rules():
assert response.text.startswith("<!DOCTYPE html>")
def test_signup():
def test_signup_and_post():
print("\nTesting signup and posting flow")
client = app.test_client()
with client: # this keeps the session between requests, which we need
signup_get_response = client.get("/signup")
@ -35,6 +36,20 @@ def test_signup():
assert "error" not in signup_post_response.location
# we should now be logged in and able to post
submit_get_response = client.get("/submit")
assert submit_get_response.status_code == 200
submit_post_response = client.post("/submit", data={
"title": "my_cool_post",
"body": "hey_guys",
})
assert submit_post_response.status_code == 302
post_render_result = client.get(submit_post_response.location)
assert "my_cool_post" in post_render_result.text
assert "hey_guys" in post_render_result.text