Example #1
0
    def setUp(self):
        super(EmailChangeConfirmationTests, self).setUp()
        self.clear_caches()
        self.addCleanup(self.clear_caches)
        self.user = UserFactory.create()
        self.profile = UserProfile.objects.get(user=self.user)
        self.req_factory = RequestFactory()
        self.request = self.req_factory.get('unused_url')
        self.request.user = self.user
        self.pending_change_request = PendingEmailChangeFactory.create(
            user=self.user)
        self.key = self.pending_change_request.activation_key

        # Expected subject of the email
        self.email_subject = u"Email Change Confirmation for {platform_name}".format(
            platform_name=settings.PLATFORM_NAME)

        # Text fragments we expect in the body of the confirmation email
        self.email_fragments = [
            u"This is to confirm that you changed the e-mail associated with {platform_name}"
            u" from {old_email} to {new_email}. If you did not make this request, please contact us immediately."
            u" Contact information is listed at:".format(
                platform_name=settings.PLATFORM_NAME,
                old_email=self.user.email,
                new_email=PendingEmailChange.objects.get(
                    activation_key=self.key).new_email),
            u"We keep a log of old e-mails, so if this request was unintentional, we can investigate."
        ]
Example #2
0
    def setUp(self):
        super(EmailChangeConfirmationTests, self).setUp()
        self.clear_caches()
        self.addCleanup(self.clear_caches)
        self.user = UserFactory.create()
        self.profile = UserProfile.objects.get(user=self.user)
        self.req_factory = RequestFactory()
        self.request = self.req_factory.get('unused_url')
        self.request.user = self.user
        self.pending_change_request = PendingEmailChangeFactory.create(user=self.user)
        self.key = self.pending_change_request.activation_key

        # Expected subject of the email
        self.email_subject = u"Email Change Confirmation for {platform_name}".format(
            platform_name=settings.PLATFORM_NAME
        )

        # Text fragments we expect in the body of the confirmation email
        self.email_fragments = [
            u"This is to confirm that you changed the e-mail associated with {platform_name}"
            u" from {old_email} to {new_email}. If you did not make this request, please contact us immediately."
            u" Contact information is listed at:".format(
                platform_name=settings.PLATFORM_NAME,
                old_email=self.user.email,
                new_email=PendingEmailChange.objects.get(activation_key=self.key).new_email
            ),
            u"We keep a log of old e-mails, so if this request was unintentional, we can investigate."
        ]
Example #3
0
 def setUp(self):
     self.user = UserFactory.create()
     self.profile = UserProfile.objects.get(user=self.user)
     self.req_factory = RequestFactory()
     self.request = self.req_factory.get('unused_url')
     self.request.user = self.user
     self.user.email_user = Mock()
     self.pending_change_request = PendingEmailChangeFactory.create(user=self.user)
     self.key = self.pending_change_request.activation_key
Example #4
0
 def setUp(self):
     self.user = UserFactory.create()
     self.profile = UserProfile.objects.get(user=self.user)
     self.req_factory = RequestFactory()
     self.request = self.req_factory.get('unused_url')
     self.request.user = self.user
     self.user.email_user = Mock()
     self.pending_change_request = PendingEmailChangeFactory.create(user=self.user)
     self.key = self.pending_change_request.activation_key
Example #5
0
 def setUp(self):
     super(EmailChangeConfirmationTests, self).setUp()
     self.clear_caches()
     self.addCleanup(self.clear_caches)
     self.user = UserFactory.create()
     self.profile = UserProfile.objects.get(user=self.user)
     self.req_factory = RequestFactory()
     self.request = self.req_factory.get('unused_url')
     self.request.user = self.user
     self.user.email_user = Mock()
     self.pending_change_request = PendingEmailChangeFactory.create(user=self.user)
     self.key = self.pending_change_request.activation_key
Example #6
0
 def setUp(self):
     super(EmailChangeConfirmationTests, self).setUp()
     self.clear_caches()
     self.addCleanup(self.clear_caches)
     self.user = UserFactory.create()
     self.profile = UserProfile.objects.get(user=self.user)
     self.req_factory = RequestFactory()
     self.request = self.req_factory.get('unused_url')
     self.request.user = self.user
     self.user.email_user = Mock()
     self.pending_change_request = PendingEmailChangeFactory.create(user=self.user)
     self.key = self.pending_change_request.activation_key