You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.9 KiB
70 lines
1.9 KiB
import pytest |
|
|
|
|
|
@pytest.mark.fun |
|
def test_login_ok(testapp): |
|
response = testapp.get("/", status=302).follow() |
|
assert "Please Log In" in response |
|
|
|
form = response.form |
|
form["username"] = "TestAdmin" |
|
form["password"] = "jane" # noqa: S105 |
|
response = form.submit("submit").follow() |
|
assert "My Orders" in response |
|
|
|
|
|
@pytest.mark.fun |
|
def test_login_wrong_username(testapp): |
|
response = testapp.get("/", status=302).follow() |
|
assert "Please Log In" in response |
|
|
|
form = response.form |
|
form["username"] = "XXAdmin" |
|
form["password"] = "jane" # noqa: S105 |
|
response = form.submit("Log In") |
|
assert "Credentials are invalid" in response |
|
|
|
|
|
@pytest.mark.fun |
|
def test_login_wrong_password(testapp): |
|
response = testapp.get("/", status=302).follow() |
|
assert "Please Log In" in response |
|
|
|
form = response.form |
|
form["username"] = "TestAdmin" |
|
form["password"] = "wrong password" # noqa: S105 |
|
response = form.submit("Log In") |
|
assert "Credentials are invalid" in response |
|
|
|
|
|
@pytest.mark.fun |
|
def test_login_fails_inactive_user(testapp): |
|
response = testapp.get("/", status=302).follow() |
|
assert "Please Log In" in response |
|
|
|
form = response.form |
|
form["username"] = "TestInactive" |
|
form["password"] = "peter" # noqa: S105 |
|
response = form.submit("Log In") |
|
assert "Credentials are invalid" in response |
|
|
|
|
|
@pytest.mark.fun |
|
def test_logout(testapp): |
|
response = testapp.get("/", status=302).follow() |
|
assert "Please Log In" in response |
|
|
|
form = response.form |
|
form["username"] = "TestAdmin" |
|
form["password"] = "jane" # noqa: S105 |
|
response = form.submit("submit").follow() |
|
assert "My Orders" in response |
|
|
|
response = testapp.get("/logout", status=302).follow() |
|
assert "Please Log In" in response |
|
|
|
|
|
@pytest.mark.fun |
|
def test_breached_faq(testapp): |
|
response = testapp.get("/breached") |
|
assert "haveibeenpwned" in response
|
|
|