コード例 #1
0
ファイル: test_user_views.py プロジェクト: AnneGilles/c3sar
    def test_user_confirm_email_view_invalid_user(self):
        """
        email confirmation -- non-validating: invalid user
        """
        from c3sar.views.user import user_confirm_email
        request = testing.DummyRequest()
        self.config = testing.setUp(request=request)

        # mock values: /user/confirm/SOME_CODE/foo/[email protected]
        request.matchdict['code'] = u"SOME_CODE"
        request.matchdict['user_name'] = u"foo"
        request.matchdict['user_email'] = u"*****@*****.**"

        result = user_confirm_email(request)
        self.assertEquals(
            result['result_msg'],
            "Something didn't work. " +
            "Please check whether you tried the right URL.")
コード例 #2
0
ファイル: test_user_views.py プロジェクト: AnneGilles/c3sar
    def test_user_confirm_email_view(self):
        """
        email confirmation view -- working
        """
        from c3sar.views.user import user_confirm_email
        request = testing.DummyRequest()
        self.config = testing.setUp(request=request)

        instance = self._makeUser2()
        self.dbsession.add(instance)

        request.matchdict['code'] = instance.email_confirm_code
        request.matchdict['user_name'] = instance.username
        request.matchdict['user_email'] = instance.email

        result = user_confirm_email(request)
        self.assertEquals(
            result['result_msg'],
            "Thanks! Your email address has been confirmed.")
コード例 #3
0
ファイル: test_user_views.py プロジェクト: AnneGilles/c3sar
    def test_user_confirm_email_view_already_confrmd(self):
        """
        email confirmation view -- already confirmed
        """
        from c3sar.views.user import user_confirm_email
        request = testing.DummyRequest()
        self.config = testing.setUp(request=request)

        instance = self._makeUser()
        self.dbsession.add(instance)

        request.matchdict['code'] = instance.email_confirm_code
        request.matchdict['user_name'] = instance.username
        request.matchdict['user_email'] = instance.email

        result = user_confirm_email(request)
        self.assertEquals(
            result['result_msg'],
            "Your email address was confirmed already.")
コード例 #4
0
ファイル: test_user_views.py プロジェクト: AnneGilles/c3sar
    def test_user_confirm_email_view_invalid_email(self):
        """
        email confirmation -- non-validating: valid user, invalid email

        e.g. a valid user with a valid code tries to confirm an invalid email
        """
        from c3sar.views.user import user_confirm_email
        request = testing.DummyRequest()
        self.config = testing.setUp(request=request)

        instance = self._makeUser2()  # valid user
        self.dbsession.add(instance)

        # mock values: /user/confirm/SOME_CODE/foo/[email protected]
        request.matchdict['code'] = instance.email_confirm_code
        request.matchdict['user_name'] = instance.username
        request.matchdict['user_email'] = u"*****@*****.**"

        result = user_confirm_email(request)
        self.assertEquals(
            result['result_msg'],
            "Verification has failed. Bummer!")