Exemplo n.º 1
0
 def create_code(self, private=True, email=''):
     code = InvitationCode(private=private)
     code.save()
     if private:
         invitation = Invitation(code=code, email=email, invited=now())
         invitation.save()
     return code
Exemplo n.º 2
0
    def setUp(self):
        """Creates a few basic users.

        Alice is registered but not in beta
        Bob is registered and in beta (self-signup)
        Charlie is in beta and has one invite
        """
        self.alice = User.objects.create_user('alice', '*****@*****.**',
                                              'secret')
        self.bob = User.objects.create_user('bob', '*****@*****.**', 'secret')
        right_now = now()
        invitation = Invitation(user=self.bob,
                                invited=right_now,
                                used=right_now)
        invitation.save()

        self.charlie = User.objects.create_user('charlie',
                                                '*****@*****.**',
                                                'secret')
        invitation = Invitation(user=self.charlie,
                                invited=right_now,
                                used=right_now)
        invitation.save()
        code = InvitationCode(owner=self.charlie)
        code.save()
Exemplo n.º 3
0
 def create_code(self, private=True, email=''):
     code = InvitationCode(private=private)
     code.save()
     if private:
         invitation = Invitation(code=code, email=email, invited=now())
         invitation.save()
     return code
Exemplo n.º 4
0
 def test_using_invite(self):
     invitation = InvitationCode(email='*****@*****.**')
     invitation.save()
     response = self.client.get(reverse('beta_verify_invite', args=[invitation.code]))
     self.assertRedirects(response, self.signup_url)
     User.objects.create_user('alice', '*****@*****.**', 'secret')
     self.client.login(username='******', password='******')
     response = self.client.get(reverse(self.signup_confirmation_view))
     response = self.client.get(reverse('beta_verify_invite', args=[invitation.code]))
     self.assertRedirects(response, reverse('beta_used'))
Exemplo n.º 5
0
 def test_using_invite(self):
     invitation = InvitationCode(email='*****@*****.**')
     invitation.save()
     response = self.client.get(
         reverse('beta_verify_invite', args=[invitation.code]))
     self.assertRedirects(response, self.signup_url)
     User.objects.create_user('alice', '*****@*****.**', 'secret')
     self.client.login(username='******', password='******')
     response = self.client.get(reverse(self.signup_confirmation_view))
     response = self.client.get(
         reverse('beta_verify_invite', args=[invitation.code]))
     self.assertRedirects(response, reverse('beta_used'))
Exemplo n.º 6
0
    def setUp(self):
        """Creates a few basic users.

        Alice is registered but not in beta
        Bob is registered and in beta (self-signup)
        Charlie is in beta and has one invite
        """
        self.alice = User.objects.create_user('alice', '*****@*****.**', 'secret')
        self.bob = User.objects.create_user('bob', '*****@*****.**', 'secret')
        right_now = now()
        invitation = Invitation(user=self.bob, invited=right_now, used=right_now)
        invitation.save()

        self.charlie = User.objects.create_user('charlie', '*****@*****.**', 'secret')
        invitation = Invitation(user=self.charlie, invited=right_now, used=right_now)
        invitation.save()
        code = InvitationCode(owner=self.charlie)
        code.save()
Exemplo n.º 7
0
 def create_invite(self, email):
     code = InvitationCode(num_invites=0)
     code.save()
     invitation = Invitation(code=code, email=email, invited=now())
     invitation.save()
     return invitation
Exemplo n.º 8
0
 def create_invite(self, email):
     code = InvitationCode(num_invites=0)
     code.save()
     invitation = Invitation(code=code, email=email, invited=now())
     invitation.save()
     return invitation
Exemplo n.º 9
0
 def create_invite(self, email, code_str="foobar"):
     code = InvitationCode(num_invites=100, code=code_str)
     code.save()
     invitation = Invitation(code=code, email=email, invited=now())
     invitation.save()
     return invitation