def test_sign_up_confirm(self): user = UserFactory(is_active=False) res = self.fetch('/api/auth/sign-up/confirm/%d/%s' % (user.id, user.auth_token())) session.commit() self.assertEqual(res.code, 200) self.assertTrue(user.is_active)
def test_sign_in_not_activated(self): user = UserFactory(is_active=False) res = self.post('/api/auth/sign-in', { 'email': user.email, 'password': '******' }) session.commit() self.assertEqual(res.code, 403)
def test_password_reset_confirm(self): user = UserFactory() res = self.post( '/api/auth/password-reset/confirm/%d/%s' % (user.id, user.auth_token()), { 'password': '******', 'password-confirm': 'newpw' }) session.commit() self.assertEqual(res.code, 200) self.assertTrue(user.check_password('newpw'))
def factory_password(self, *args, **kwargs): self.set_password('pw') session.commit()