Ejemplo n.º 1
0
 def test_send_password_reset_email(self):
     existingUser = AuthUser.objects.create(username='******',email='*****@*****.**',is_active=True)
     sentMail = tracker.auth.send_password_reset_mail('', existingUser, template=TEST_AUTH_MAIL_TEMPLATE)
     contents = test_util.parse_test_mail(sentMail)
     self.assertEqual(existingUser.username, contents['user'][0])
     domainURL,middle,suffix = contents['url'][0].partition('?')
     self.assertEqual(tracker.auth.make_auth_token_url_suffix(existingUser), suffix)
Ejemplo n.º 2
0
 def test_registration_flow(self):
     request = self.factory.post(reverse('tracker:register'))
     new_user = AuthUser.objects.create(username='******',
                                        email='*****@*****.**',
                                        is_active=False)
     sent_mail = tracker.auth.send_registration_mail(
         request, new_user, template=TEST_AUTH_MAIL_TEMPLATE)
     contents = test_util.parse_test_mail(sent_mail)
     self.assertEqual(new_user.username, contents['user'][0])
     parsed = urllib.parse.urlparse(contents['url'][0])
     resp = self.client.get(parsed.path)
     expected_url = reverse(
         'tracker:confirm_registration',
         kwargs={
             'uidb64': urlsafe_base64_encode(force_bytes(new_user.pk)),
             'token': 'register-user',
         },
     )
     self.assertRedirects(resp, expected_url)
     resp = self.client.get(expected_url)
     self.assertContains(resp, 'Please set your username and password.')
     resp = self.client.post(
         expected_url,
         {
             'username': '******',
             'password': '******',
             'passwordconfirm': 'foobar',
         },
     )
     self.assertContains(resp, 'Your user account has been confirmed')
     new_user.refresh_from_db()
     self.assertTrue(new_user.is_active)
     self.assertTrue(new_user.check_password('foobar'))
Ejemplo n.º 3
0
 def _parseMail(self, mail):
     contents = test_util.parse_test_mail(mail)
     event = int(contents['event'][0])
     winnerId = int(contents['winner'][0])
     prizeWins = list([int(x) for x in contents.get('prizewinner', [])])
     reply = contents['reply'][0]
     return event, winnerId, prizeWins, reply
Ejemplo n.º 4
0
 def test_send_registration_email(self):
     newUser = AuthUser.objects.create(username='******',email='*****@*****.**',is_active=False)
     sentMail = tracker.auth.send_registration_mail('', newUser, template=TEST_AUTH_MAIL_TEMPLATE)
     contents = test_util.parse_test_mail(sentMail)
     self.assertEqual(newUser.username, contents['user'][0])
     domainURL,middle,suffix = contents['url'][0].partition('?')
     self.assertEqual(tracker.auth.make_auth_token_url_suffix(newUser), suffix)
 def _parseMail(self, mail):
     contents = test_util.parse_test_mail(mail)
     event = int(contents['event'][0])
     handlerId = int(contents['handlerid'][0])
     accepted = list(map(lambda x: int(x), contents.get('accepted', [])))
     denied = list(map(lambda x: int(x), contents.get('denied', [])))
     return event, handlerId, accepted, denied
Ejemplo n.º 6
0
 def _parseMail(self, mail):
     contents = test_util.parse_test_mail(mail)
     event = int(contents['event'][0])
     handlerId = int(contents['handlerid'][0])
     accepted = list([int(x) for x in contents.get('accepted', [])])
     denied = list([int(x) for x in contents.get('denied', [])])
     return event, handlerId, accepted, denied
 def _parseMail(self, mail):
     contents = test_util.parse_test_mail(mail)
     event = int(contents['event'][0])
     winnerId = int(contents['winner'][0])
     prizeWins = list(map(lambda x: int(x), contents.get('prizewinner', [])))
     reply = contents['reply'][0]
     return event, winnerId, prizeWins, reply
 def _parseMail(self, mail):
     contents = test_util.parse_test_mail(mail)
     event = int(contents['event'][0])
     handlerId = int(contents['handlerid'][0])
     prizeWins = list(map(lambda x: int(x), contents.get('prizewinner', [])))
     reply = contents['reply'][0]
     return event, handlerId, prizeWins, reply
Ejemplo n.º 9
0
 def test_send_password_reset_email(self):
     existingUser = AuthUser.objects.create(
         username='******', email='*****@*****.**', is_active=True)
     sentMail = tracker.auth.send_password_reset_mail(
         '', existingUser, template=TEST_AUTH_MAIL_TEMPLATE)
     contents = test_util.parse_test_mail(sentMail)
     self.assertEqual(existingUser.username, contents['user'][0])
     domainURL, middle, suffix = contents['url'][0].partition('?')
     self.assertEqual(
         tracker.auth.make_auth_token_url_suffix(existingUser), suffix)
Ejemplo n.º 10
0
 def test_send_registration_email(self):
     newUser = AuthUser.objects.create(
         username='******', email='*****@*****.**', is_active=False)
     sentMail = tracker.auth.send_registration_mail(
         '', newUser, template=TEST_AUTH_MAIL_TEMPLATE)
     contents = test_util.parse_test_mail(sentMail)
     self.assertEqual(newUser.username, contents['user'][0])
     domainURL, middle, suffix = contents['url'][0].partition('?')
     self.assertEqual(
         tracker.auth.make_auth_token_url_suffix(newUser), suffix)
Ejemplo n.º 11
0
 def _parseMail(self, mail):
     contents = test_util.parse_test_mail(mail)
     event = int(contents['event'][0])
     winner = int(contents['winner'][0])
     prizes = [int(p) for p in contents.get('prize', [])]
     return event, winner, prizes
Ejemplo n.º 12
0
 def _parseMail(self, mail):
     contents = test_util.parse_test_mail(mail)
     event = int(contents['event'][0])
     winner = int(contents['winner'][0])
     prizes = [int(p) for p in contents.get('prize', [])]
     return event, winner, prizes
Ejemplo n.º 13
0
 def _parseMail(self, mail):
     contents = test_util.parse_test_mail(mail)
     event = int(contents['event'][0])
     winner = int(contents['winner'][0])
     prizes = list(map(lambda x: int(x), contents.get('prize', [])))
     return event, winner, prizes