Exemple #1
0
 def test_valid_password(self):
     token = invite_token(self.factory.user)
     password = '******'
     response = self.post_request('/invite/{}'.format(token), data={'password': password}, org=self.factory.org)
     self.assertEqual(response.status_code, 302)
     user = User.query.get(self.factory.user.id)
     self.assertTrue(user.verify_password(password))
Exemple #2
0
 def test_user_invited_before_invitation_pending_check(self):
     user = self.factory.create_user(details={})
     token = invite_token(user)
     response = self.post_request('/invite/{}'.format(token),
                                  data={'password': '******'},
                                  org=self.factory.org)
     self.assertEqual(response.status_code, 302)
Exemple #3
0
    def test_expired_invite_token(self):

        with mock.patch('time.time') as patched_time:
            patched_time.return_value = time.time() - (7 * 24 * 3600) - 10
            token = invite_token(self.factory.user)

        response = self.get_request('/invite/{}'.format(token), org=self.factory.org)
        self.assertEqual(response.status_code, 400)
Exemple #4
0
 def test_already_active_user(self):
     token = invite_token(self.factory.user)
     self.post_request('/invite/{}'.format(token),
                       data={'password': '******'},
                       org=self.factory.org)
     response = self.get_request('/invite/{}'.format(token),
                                 org=self.factory.org)
     self.assertEqual(response.status_code, 400)
 def test_valid_password(self):
     user = self.factory.create_user(is_invitation_pending=True)
     token = invite_token(user)
     password = '******'
     response = self.post_request('/invite/{}'.format(token), data={'password': password}, org=self.factory.org)
     self.assertEqual(response.status_code, 302)
     user = User.query.get(user.id)
     self.assertTrue(user.verify_password(password))
     self.assertFalse(user.is_invitation_pending)
Exemple #6
0
 def test_valid_password(self):
     user = self.factory.create_user(is_invitation_pending=True)
     token = invite_token(user)
     password = '******'
     response = self.post_request('/invite/{}'.format(token),
                                  data={'password': password},
                                  org=self.factory.org)
     self.assertEqual(response.status_code, 302)
     user = User.query.get(user.id)
     self.assertTrue(user.verify_password(password))
     self.assertFalse(user.is_invitation_pending)
 def test_already_active_user(self):
     token = invite_token(self.factory.user)
     self.post_request(
         "/invite/{}".format(token),
         data={"password": "******"},
         org=self.factory.org,
     )
     response = self.post_request(
         "/invite/{}".format(token),
         data={"password": "******"},
         org=self.factory.org,
     )
     self.assertEqual(response.status_code, 400)
Exemple #8
0
 def test_invalid_password(self):
     token = invite_token(self.factory.user)
     response = self.post_request('/invite/{}'.format(token), data={'password': '******'}, org=self.factory.org)
     self.assertEqual(response.status_code, 400)
Exemple #9
0
 def test_valid_token(self):
     token = invite_token(self.factory.user)
     response = self.get_request('/invite/{}'.format(token), org=self.factory.org)
     self.assertEqual(response.status_code, 200)
 def test_empty_password(self):
     token = invite_token(self.factory.user)
     response = self.post_request("/invite/{}".format(token),
                                  data={"password": ""},
                                  org=self.factory.org)
     self.assertEqual(response.status_code, 400)
 def test_valid_token(self):
     user = self.factory.create_user(is_invitation_pending=True)
     token = invite_token(user)
     response = self.get_request("/invite/{}".format(token),
                                 org=self.factory.org)
     self.assertEqual(response.status_code, 200)
 def test_shows_reset_password_form(self):
     user = self.factory.create_user(is_invitation_pending=False)
     token = invite_token(user)
     response = self.get_request("/reset/{}".format(token),
                                 org=self.factory.org)
     self.assertEqual(response.status_code, 200)
 def test_already_active_user(self):
     token = invite_token(self.factory.user)
     self.post_request('/invite/{}'.format(token), data={'password': '******'}, org=self.factory.org)
     response = self.post_request('/invite/{}'.format(token), data={'password': '******'}, org=self.factory.org)
     self.assertEqual(response.status_code, 400)
 def test_user_invited_before_invitation_pending_check(self):
     user = self.factory.create_user(details={})
     token = invite_token(user)
     response = self.post_request('/invite/{}'.format(token), data={'password': '******'}, org=self.factory.org)
     self.assertEqual(response.status_code, 302)
 def test_valid_token(self):
     user = self.factory.create_user(is_invitation_pending=True)
     token = invite_token(user)
     response = self.get_request('/invite/{}'.format(token), org=self.factory.org)
     self.assertEqual(response.status_code, 200)