예제 #1
0
 def wrapper(*args, **kwargs):
     if not request.is_json:
         return jsonify({
             'success': False,
             'error': 'json body required'
         }), 400
     body = request.json
     user = lcs_client.User(token=body['token'])
     return f(*args, user=user, **kwargs)
예제 #2
0
def test_user_get_dm_link_for(mocker):
    mocker.patch('lcs_client.create_dm_link_between', return_value=TEST_URL)
    usr = lcs_client.User(token=TEST_TOKEN)
    dm_link = usr.create_dm_link_to(other_user_email='*****@*****.**')
    assert dm_link == TEST_URL
예제 #3
0
def test_bad_user_no_credentials():
    with pytest.raises(Exception):
        lcs_client.User()
예제 #4
0
def test_user_get_profile(mocker):
    mocker.patch('lcs_client.get_profile', return_value=TEST_PROFILE)
    usr = lcs_client.User(token=TEST_TOKEN)
    usr_profile = usr.profile()
    assert usr_profile == TEST_PROFILE
예제 #5
0
def test_successful_user_creation_using_token(mocker):
    usr = lcs_client.User(token=TEST_TOKEN)
    assert usr.email == TEST_EMAIL
    assert usr.token == TEST_TOKEN
예제 #6
0
def test_successful_user_creation_using_email_password(mocker):
    mocker.patch('lcs_client.login', return_value=TEST_TOKEN)
    usr = lcs_client.User(email=TEST_EMAIL, password=TEST_PASSWORD)
    assert usr.token == TEST_TOKEN
    assert usr.email == '*****@*****.**'
예제 #7
0
def test_bad_user_missing_password():
    with pytest.raises(Exception):
        lcs_client.User(email=TEST_EMAIL)
예제 #8
0
def test_bad_user_missing_email():
    with pytest.raises(Exception):
        lcs_client.User(password=TEST_PASSWORD)