def test_user_login_redirects_to_index(client, user): u = User() u.email = user['email'] u.password = user['password'] u.confirmed = True db.session.add(u) db.session.commit() data = {'email': user['email'], 'password': user['password']} response = client.post(url_for('auth.login'), data=data, follow_redirects=True) assert b'<h1>Page Header</h1>' in response.data
def test_login_required(clean_db, client, path): u = User() u.password = '******' u.email = '*****@*****.**' u.confirmed = True response = client.post(url_for('auth.login'), data={ 'email': '*****@*****.**', 'password': '******' }, follow_redirects=True) assert client.get(url_for(path), follow_redirects=True).status_code == 200