def test_get_current(): email = get_random_email() create_user(email, 'pass') token = login_user(email, 'pass') user = get_user(token=token) assert user['email'] == email assert user['balance'] == 2.5
def test_send_sms(): email = get_random_email() create_user(email, 'pass') token = login_user(email, 'pass') verify_user(token) send_sms(token, '+123', 'text', 'god') last_message = query_last_message('+123') assert last_message['text'] == 'text' assert last_message['from'] == 'god'
def test_balance_sms_send_balance_depleted(): email = get_random_email() create_user(email, 'pass') token = login_user(email, 'pass') verify_user(token) for dummy in xrange(5): send_sms(token, '+123', 'text', 'god') with pytest.raises(requests.HTTPError): send_sms(token, '+123', 'text', 'god')
def test_send_sms_without_verify_throws_exception(): email = get_random_email() create_user(email, 'pass') token = login_user(email, 'pass') with pytest.raises(requests.HTTPError): send_sms(token, '+123', 'text', 'god')
def test_register(): email = get_random_email() new_user = create_user(email, 'pass') assert new_user['email'] == email
def test_login_with_bad_password(): email = get_random_email() create_user(email, 'pass') with pytest.raises(HTTPError): login_user(email, 'wrong_pass')
def test_token_guard(): email = get_random_email() create_user(email, 'pass') token = login_user(email, 'pass') with pytest.raises(HTTPError): token = refresh_token(token + '1')
def test_login(): email = get_random_email() create_user(email, 'pass') token = login_user(email, 'pass') token = refresh_token(token)
def test_register_user_twice(): email = get_random_email() create_user(email, 'pass') with pytest.raises(requests.HTTPError): create_user(email, 'pass')