コード例 #1
0
ファイル: test_views.py プロジェクト: DirectEmployers/MyJobs
    def test_accept_invitation_already_activated(self):
        """
        Since invitations use the same keys as activations, we should ensure
        that invitation acceptance doesn't show an error message when the link
        has already been used.
        """
        invitation = InvitationFactory(invitee_email=self.user.email)
        invitation.send()
        self.assertFalse(invitation.accepted)
        profile = self.user.activationprofile_set.all()[0]
        key = profile.activation_key
        self.user.in_reserve = True
        self.user.save()

        # Quickly activate and ensure that activation was successful
        self.assertEqual(ActivationProfile.objects.activate_user(key),
                         self.user)

        self.client.login_user(self.user)
        response = self.client.get(reverse('invitation_activate', args=[key]))

        self.assertTrue('Account Activated' in response.content)
        invitation = Invitation.objects.get()
        invitation.send()
        self.assertTrue(invitation.accepted)
        user = User.objects.get(pk=self.user.pk)
        self.assertFalse(user.in_reserve)
コード例 #2
0
ファイル: test_views.py プロジェクト: supervisitor20/MyJobs
    def test_generic_invitation_message(self):
        """
        Tests that generic invitation emails are formatted correctly.

        """
        invitation = InvitationFactory(inviting_user=self.user)
        invitation.send()

        email = mail.outbox.pop()
        self.assertIn("has invited you to join My.jobs.", email.body)
コード例 #3
0
ファイル: test_views.py プロジェクト: DirectEmployers/MyJobs
    def test_generic_invitation_message(self):
        """
        Tests that generic invitation emails are formatted correctly.

        """
        invitation = InvitationFactory(inviting_user=self.user)
        invitation.send()

        email = mail.outbox.pop()
        self.assertIn("has invited you to join My.jobs.", email.body)
コード例 #4
0
ファイル: test_views.py プロジェクト: supervisitor20/MyJobs
    def test_custom_invitation_message(self):
        """
        Test that invitation messages with custom reasons are formatted
        correctly.

        """
        invitation = InvitationFactory(inviting_user=self.user)
        invitation.send("in order to do some custom stuff.")

        email = mail.outbox.pop()
        self.assertIn("in order to do some custom stuff.", email.body)
コード例 #5
0
ファイル: test_views.py プロジェクト: DirectEmployers/MyJobs
    def test_custom_invitation_message(self):
        """
        Test that invitation messages with custom reasons are formatted
        correctly.

        """
        invitation = InvitationFactory(inviting_user=self.user)
        invitation.send("in order to do some custom stuff.")

        email = mail.outbox.pop()
        self.assertIn("in order to do some custom stuff.", email.body)
コード例 #6
0
ファイル: test_views.py プロジェクト: DirectEmployers/MyJobs
    def test_saved_search_invitation_message(self):
        """
        Tests that saved search invitation emails are formatted correctly.

        """
        saved_search = SavedSearchFactory(user=self.user)
        invitation = InvitationFactory(inviting_user=self.user)
        invitation.send(saved_search)

        email = mail.outbox.pop()
        self.assertIn("in order to begin receiving their available job "
                      "opportunities on a regular basis", email.body)
コード例 #7
0
ファイル: test_views.py プロジェクト: supervisitor20/MyJobs
    def test_saved_search_invitation_message(self):
        """
        Tests that saved search invitation emails are formatted correctly.

        """
        saved_search = SavedSearchFactory(user=self.user)
        invitation = InvitationFactory(inviting_user=self.user)
        invitation.send(saved_search)

        email = mail.outbox.pop()
        self.assertIn(
            "in order to begin receiving their available job "
            "opportunities on a regular basis", email.body)
コード例 #8
0
ファイル: test_views.py プロジェクト: supervisitor20/MyJobs
    def test_invitation_asks_for_password_change(self):
        """
        When activating an account via an invitation, the user should still be
        prompted to change their password.
        """
        invitation = InvitationFactory(inviting_user=self.user)
        invitation.send()
        key = invitation.invitee.activationprofile_set.first().activation_key
        response = self.client.get(
            reverse('invitation_activate', kwargs={'activation_key': key}),
            data={'verify-email': invitation.invitee_email})

        invitee = User.objects.get(pk=invitation.invitee.pk)

        self.assertTrue(invitee.password_change)
コード例 #9
0
ファイル: test_views.py プロジェクト: DirectEmployers/MyJobs
    def test_invitation_asks_for_password_change(self):
        """
        When activating an account via an invitation, the user should still be
        prompted to change their password.
        """
        invitation = InvitationFactory(inviting_user=self.user)
        invitation.send()
        key = invitation.invitee.activationprofile_set.first().activation_key
        response = self.client.get(
            reverse('invitation_activate', kwargs={'activation_key': key}),
            data={'verify-email': invitation.invitee_email})

        invitee = User.objects.get(pk=invitation.invitee.pk)

        self.assertTrue(invitee.password_change)
コード例 #10
0
ファイル: test_views.py プロジェクト: supervisitor20/MyJobs
    def test_accept_invitation_already_activated(self):
        """
        Since invitations use the same keys as activations, we should ensure
        that invitation acceptance doesn't show an error message when the link
        has already been used.
        """
        invitation = InvitationFactory(invitee_email=self.user.email)
        invitation.send()
        self.assertFalse(invitation.accepted)
        profile = self.user.activationprofile_set.all()[0]
        key = profile.activation_key
        self.user.in_reserve = True
        self.user.save()

        # Quickly activate and ensure that activation was successful
        self.assertEqual(ActivationProfile.objects.activate_user(key),
                         self.user)

        self.client.login_user(self.user)
        response = self.client.get(reverse('invitation_activate', args=[key]))

        self.assertTrue('Account Activated' in response.content)
        invitation = Invitation.objects.get()
        invitation.send()
        self.assertTrue(invitation.accepted)
        user = User.objects.get(pk=self.user.pk)
        self.assertFalse(user.in_reserve)