Ejemplo n.º 1
0
def test_check_user_email():
    #register a user with email
    reset()
    auth_register(email, password, fname, lname)
    # should raises error for registering the same email again
    with pytest.raises(error.InputError):
        assert auth_register(email, "1111111", "jack", "tom")
Ejemplo n.º 2
0
def test_auth_logout():
    reset()
    auth_register(email, password, fname, lname)
    usr = auth_login(email, password)
    usr_token = usr['token']
    k = auth_logout(usr_token)
    assert k == True
Ejemplo n.º 3
0
def test_user_login_email():
    reset()
    with pytest.raises(InputError):
        assert [
            auth_register(email,
                          password="******",
                          name_first="farnaz",
                          name_last="jade") for email in li
        ]
Ejemplo n.º 4
0
def test_check_unique_token():
    reset()
    data1 = auth_register(email, password, fname, lname)
    user1_token = data1['token']
    user1_id = data1['u_id']
    data2 = auth_register("*****@*****.**", "567890", "lou", "james")
    user2_token = data2['token']
    user2_id = data2['u_id']
    assert user1_token != user2_token
    assert user1_id != user2_id
Ejemplo n.º 5
0
def test_unactive_logout():
    reset()
    auth_register(email, password, fname, lname)
    usr = auth_login(email, password)
    usr_token = usr['token']
    auth_logout(usr_token)
    with pytest.raises(Exception):
        assert auth_logout(usr_token)


# # tying to log out an unvalid token

# def test_unvalid_token():

#     with pytest.raises(Exception):
#         assert auth_logout("THISISNOTATOKEN")
Ejemplo n.º 6
0
def test_user_pass():
    reset()
    auth_register(email, password, fname, lname)
    with pytest.raises(InputError):
        assert auth_login(email, "123")
Ejemplo n.º 7
0
def test_token():
    reset()
    user_id1, user_token1 = auth_register(email, password, fname, lname)
    user_id2, user_token2 = auth_login(email, password)
    assert user_id2 == user_id1
    assert user_token1 == user_token2
Ejemplo n.º 8
0
def test_long_last_name():
    reset()
    with pytest.raises(InputError):
        assert auth_register(email, password, fname, longname)
Ejemplo n.º 9
0
def test_password():
    reset()
    with pytest.raises(InputError):
        assert auth_register(email, "123", fname, lname)
Ejemplo n.º 10
0
def test_register():
    reset()
    with pytest.raises(InputError):
        assert auth_register("123", "12345", "fl", "th")
Ejemplo n.º 11
0
def test_register_works():
    reset()
    auth_register(email, password, fname, lname)
    auth_login(email, password)