def test_invalid_user_cannot_login(mockdata, client, session): with current_app.test_request_context(): form = LoginForm(email='*****@*****.**', password='******', remember_me=True) rv = client.post(url_for('auth.login'), data=form.data) assert 'Invalid username or password.' in rv.data
def test_register_user_approval_required(mockdata, client, session): current_app.config['APPROVE_REGISTRATIONS'] = True with current_app.test_request_context(): diceware_password = '******' form = RegistrationForm(email='*****@*****.**', username='******', password=diceware_password, password2=diceware_password) rv = client.post(url_for('auth.register'), data=form.data, follow_redirects=True) assert 'Once an administrator approves your registration, you will ' \ 'receive a confirmation email to activate your account.' in rv.data.decode('utf-8') form = LoginForm(email='*****@*****.**', password=diceware_password, remember_me=True) rv = client.post(url_for('auth.login'), data=form.data, follow_redirects=False) assert b'Invalid username or password' not in rv.data rv = client.get(url_for('auth.unconfirmed'), follow_redirects=False) assert b'administrator has not approved your account yet' in rv.data
def login_unconfirmed_user(client): form = LoginForm(email='*****@*****.**', password='******', remember_me=True) rv = client.post(url_for('auth.login'), data=form.data, follow_redirects=False) return rv
def login_ac(client): form = LoginForm(email='*****@*****.**', password='******', remember_me=True) rv = client.post(url_for('auth.login'), data=form.data, follow_redirects=False) return rv
def login_admin(client): form = LoginForm(email='*****@*****.**', password='******', remember_me=True) rv = client.post(url_for('auth.login'), data=form.data, follow_redirects=False) return rv
def login_admin(client): form = LoginForm(email=ADMIN_EMAIL, password=ADMIN_PASSWORD, remember_me=True) rv = client.post(url_for('auth.login'), data=form.data, follow_redirects=False) return rv