예제 #1
0
파일: test_app.py 프로젝트: odra/anitya
    def test_not_email(self):
        """Assert an IntegrityError without the email key results in a 500 error"""
        err = IntegrityError('SQL Statement', {}, None)

        msg, errno = app.integrity_error_handler(err)

        self.assertEqual(500, errno)
        self.assertEqual('The server encountered an unexpected error', msg)
예제 #2
0
    def test_not_email(self):
        """Assert an IntegrityError without the email key results in a 500 error"""
        err = IntegrityError("SQL Statement", {}, None)

        msg, errno = app.integrity_error_handler(err)

        self.assertEqual(500, errno)
        self.assertEqual("The server encountered an unexpected error", msg)
예제 #3
0
    def test_email(self):
        """Assert an HTTP 400 is generated from an email IntegrityError."""

        err = IntegrityError('SQL Statement', {'email': '*****@*****.**'},
                             None)
        expected_msg = (
            "Error: There's already an account associated with your email, "
            "authenticate with Demo Provider.")

        msg, errno = app.integrity_error_handler(err)

        self.assertEqual(400, errno)
        self.assertEqual(expected_msg, msg)
예제 #4
0
    def test_no_social_auth(self):
        """Assert an HTTP 500 is generated from an social_auth IntegrityError."""

        err = IntegrityError("SQL Statement", {"email": "*****@*****.**"}, None)
        expected_msg = (
            "Error: There was already an existing account with missing provider. "
            "So we removed it. "
            "Please try to log in again."
        )

        msg, errno = app.integrity_error_handler(err)

        self.assertEqual(500, errno)
        self.assertEqual(expected_msg, msg)
예제 #5
0
파일: test_app.py 프로젝트: odra/anitya
    def test_no_social_auth(self):
        """Assert an HTTP 500 is generated from an social_auth IntegrityError."""

        err = IntegrityError('SQL Statement', {'email': '*****@*****.**'},
                             None)
        expected_msg = (
            "Error: There was already an existing account with missing provider. "
            "So we removed it. "
            "Please try to log in again.")

        msg, errno = app.integrity_error_handler(err)

        self.assertEqual(500, errno)
        self.assertEqual(expected_msg, msg)
예제 #6
0
    def test_no_social_auth(self):
        """Assert an HTTP 400 is generated from an social_auth IntegrityError."""

        err = IntegrityError('SQL Statement', {
            'social_auth': 'user',
            'email': '*****@*****.**'
        }, None)
        expected_msg = (
            "Error: Authentication with authentication provider failed. "
            "Please try again later...")

        msg, errno = app.integrity_error_handler(err)

        self.assertEqual(500, errno)
        self.assertEqual(expected_msg, msg)
예제 #7
0
파일: test_app.py 프로젝트: odra/anitya
    def test_email(self):
        """Assert an HTTP 400 is generated from an email IntegrityError."""

        social_auth_user = social_models.UserSocialAuth(
            provider='Demo Provider', user=self.user)
        self.session.add(social_auth_user)
        self.session.commit()

        err = IntegrityError('SQL Statement', {'email': '*****@*****.**'},
                             None)
        expected_msg = (
            "Error: There's already an account associated with your email, "
            "authenticate with Demo Provider.")

        msg, errno = app.integrity_error_handler(err)

        self.assertEqual(400, errno)
        self.assertEqual(expected_msg, msg)
예제 #8
0
    def test_email(self):
        """Assert an HTTP 400 is generated from an email IntegrityError."""

        social_auth_user = social_models.UserSocialAuth(
            provider="Demo Provider", user=self.user
        )
        self.session.add(social_auth_user)
        self.session.commit()

        err = IntegrityError("SQL Statement", {"email": "*****@*****.**"}, None)
        expected_msg = (
            "Error: There's already an account associated with your email, "
            "authenticate with Demo Provider."
        )

        msg, errno = app.integrity_error_handler(err)

        self.assertEqual(400, errno)
        self.assertEqual(expected_msg, msg)