Exemple #1
0
def test_customer_login(client, customer):
    """Make sure login and logout works."""
    response = login(client, CUSTOMER_EMAIL, CUSTOMER_PASSWORD)
    # assert response.json["response"]["user"]["authentication_token"]
    assert response.status_code == 200
    logout(client)

    response = login(client, CUSTOMER_EMAIL, "Wrong password")
    assert response.status_code == 400
    assert response.json["response"]["errors"]["password"] == ["Invalid password"]
Exemple #2
0
def test_employee_login(client, employee):
    """Make sure login and logout works."""
    response = login(client, EMPLOYEE_EMAIL, EMPLOYEE_PASSWORD)
    assert response.status_code == 200
    # assert response.json["response"]["user"]["authentication_token"]
    logout(client)

    response = login(client, EMPLOYEE_EMAIL, "Wrong password")
    assert response.status_code == 400
    assert response.json["response"]["errors"]["password"] == ["Invalid password"]
Exemple #3
0
def test_student_login(client, student):
    """Make sure login and logout works."""
    response = login(client, STUDENT_EMAIL, STUDENT_PASSWORD)
    assert response.json["response"]["user"]["authentication_token"]
    assert response.status_code == 200
    logout(client)

    response = login(client, STUDENT_EMAIL, "Wrong password")
    assert response.status_code == 400
    assert response.json["response"]["errors"]["password"] == [
        'Invalid password'
    ]
Exemple #4
0
def test_teacher_login(client, teacher):
    """Make sure login and logout works."""
    response = login(client, TEACHER_EMAIL, TEACHER_PASSWORD)
    assert response.status_code == 200
    assert response.json["response"]["user"]["authentication_token"]
    logout(client)

    response = login(client, TEACHER_EMAIL, "Wrong password")
    assert response.status_code == 400
    assert response.json["response"]["errors"]["password"] == [
        'Invalid password'
    ]
Exemple #5
0
def test_quick_token_retrieval(app, client, student):
    response = login(client, STUDENT_EMAIL, STUDENT_PASSWORD)
    assert response.status_code == 200
    auth_token = response.json["response"]["user"]["authentication_token"]
    headers = {"Authentication-Token": auth_token}
    response = client.get('/v1/users/current-user', headers=headers)
    assert response.status_code == 200
    assert response.json["quick_token"]
Exemple #6
0
def test_auth_token_retrieval(app, client, employee):
    response = login(client, EMPLOYEE_EMAIL, EMPLOYEE_PASSWORD)
    assert response.status_code == 200
    auth_token = response.json["response"]["user"]["authentication_token"]
    assert auth_token
Exemple #7
0
def test_unconfirmed_employee_login(client, employee_unconfirmed):
    """Make sure login shows confirmation error."""
    response = login(client, EMPLOYEE_EMAIL, EMPLOYEE_PASSWORD)
    assert response.json["response"]["errors"]["email"][0] == "Email requires confirmation."
    assert response.status_code == 400
Exemple #8
0
def test_unconfirmed_customer_login(client, customer_unconfirmed):
    """Make sure login shows confirmation error."""
    response = login(client, CUSTOMER_EMAIL, CUSTOMER_PASSWORD)
    assert response.json["response"]["errors"]["email"][0] == "Email requires confirmation."
    assert response.status_code == 400
Exemple #9
0
def test_unconfirmed_student_login(client, student_unconfirmed):
    """Make sure login shows confirmation error."""
    response = login(client, STUDENT_EMAIL, STUDENT_PASSWORD)
    assert response.json["response"]["errors"]["email"][
        0] == "Email requires confirmation."
    assert response.status_code == 400