Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def register(client, username, password, email, first_name, last_name, phone):
- return client.post("/register", data=dict(
- username=username,
- password=password,
- email=email,
- first_name=first_name,
- last_name=last_name,
- phone=phone
- ), follow_redirects=True)
- def login(client, email, password):
- return client.post("/login", data=dict(
- email=email,
- password=password
- ), follow_redirects=True)
- def test_register(client):
- """Make sure register works."""
- rv = register(client, "testuser", "testpassword", "testuser@gmail.com", "test name", "test lastname", 911)
- assert b"New user: 'testuser' is SUCCESSFUL ADDED" in rv.data
- def test_login_logout(client):
- """Make sure login and logout works."""
- rv = login(client, "vlad@gmail.com", "vlad")
- assert b"Logged in as vlad@gmail.com" in rv.data
- rv = smoke(client)
- assert b"OK" in rv.data
- rv = logout(client)
- assert b"Dropped" in rv.data
- rv = smoke(client)
- assert b"You are not allowed to use this resource without logging in!" in rv.data
- rv = login(client, "vlad@gmail.com" + "x", "vlad")
- assert b"Could not verify your login!" in rv.data
- rv = login(client, "vlad@gmail.com" + "x", "vlad" + "x")
- assert b"Could not verify your login!" in rv.data
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement