예제 #1
0
def test_check_user_email():
    #register a user with email
    test_server.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")
예제 #2
0
def test_auth_logout():
    test_server.reset()
    auth_register(email, password, fname, lname)
    usr = auth_login(email, password)
    usr_token = usr['token']
    k = auth_logout(usr_token)
    assert k == True
예제 #3
0
def test_user_login_email():
    test_server.reset()
    with pytest.raises(InputError):
        assert [
            auth_register(email,
                          password="******",
                          name_first="farnaz",
                          name_last="jade") for email in li
        ]
예제 #4
0
def test_check_unique_token():
    test_server.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
예제 #5
0
def test_unactive_logout():
    test_server.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")
예제 #6
0
def test_user_pass():
    test_server.reset()
    auth_register(email, password, fname, lname)
    with pytest.raises(InputError):
        assert auth_login(email, "123")
예제 #7
0
def test_token():
    test_server.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
예제 #8
0
def test_long_last_name():
    test_server.reset()
    with pytest.raises(InputError):
        assert auth_register(email, password, fname, longname)
예제 #9
0
def test_password():
    test_server.reset()
    with pytest.raises(InputError):
        assert auth_register(email, "123", fname, lname)
예제 #10
0
def test_register():
    test_server.reset()
    with pytest.raises(InputError):
        assert auth_register("123", "12345", "fl", "th")
예제 #11
0
def test_register_works():
    test_server.reset()
    auth_register(email, password, fname, lname)
    auth_login(email, password)