aboutsummaryrefslogtreecommitdiff
path: root/app/tests/test_forms.py
blob: ebfee8a277b9cf4bba3d7a9cf2ab0e7df6f3d855 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# -*- coding: utf-8 -*-
"""
Test(s) for Forms

Tests the forms and their validations
"""


def test_incorrect_forms(app, client):
    """
    Simulate Invalid Forms
    """
    res = client.post("/signin", data={"email": "123"})
    assert b"This field is required." in res.data

    res = client.post("/signup", data={"email": "123"})
    assert b"This field is required." in res.data

    res = client.post("/ContactUs", data={"email": 123})
    assert b"This field is required." in res.data


def test_contactus(app, client):
    """Test Valid Form Submission"""
    res = client.post(
        "/ContactUs",
        data={
            "name": "Test User",
            "subject": "Test Contact",
            "email": "testemail@email.com",
            "body": "Test Message",
        },
        follow_redirects=True,
    )
    assert res.status_code == 200
    assert b"Wuhu" in res.data