Exemplo n.º 1
0
def test_web_find_strange_user(f_session, f_user):
    u = {'id': f_user.id, 'email': f_user.email, 'name': f_user.name}
    t, _ = generate_token(u)
    url = url_for('user.find_user', id_=1231231232, token=t)
    with app.test_client() as c:
        r = c.get(url)
    assert 404 == r.status_code
Exemplo n.º 2
0
def test_web_find_other_user(f_session, f_user):
    other = User(email='*****@*****.**', password='******')
    f_session.add(other)
    f_session.commit()
    u = {'id': f_user.id, 'email': f_user.email, 'name': f_user.name}
    t, _ = generate_token(u)
    url = url_for('user.find_user', id_=other.id, token=t)
    with app.test_client() as c:
        r = c.get(url)
    assert 403 == r.status_code
Exemplo n.º 3
0
def test_web_find_me(f_session, f_user):
    u = {'id': f_user.id, 'email': f_user.email, 'name': f_user.name}
    t, _ = generate_token(u)
    url = url_for('user.find_me', id_=f_user.id, token=t)
    _test_find_user(url, f_user)