예제 #1
0
    def test_valid(self):
        with mock.patch('sentry.coreapi.get_signature') as get_signature:
            get_signature.return_value = 'signature'

            validate_hmac('foo', 'signature', time.time(), 'foo')
예제 #2
0
파일: tests.py 프로젝트: lettertwo/sentry
    def test_invalid_validate_hmac_expired(self):
        with mock.patch('sentry.coreapi.get_signature') as get_signature:
            get_signature.return_value = 'signature'

            with self.assertRaises(APITimestampExpired):
                validate_hmac('foo', 'signature', time.time() - 3601, 'foo')
예제 #3
0
파일: tests.py 프로젝트: lettertwo/sentry
    def test_invalid_validate_hmac_bad_timestamp(self):
        with mock.patch('sentry.coreapi.get_signature') as get_signature:
            get_signature.return_value = 'signature'

            with self.assertRaises(APIError):
                validate_hmac('foo', 'signature', 'foo', 'foo')
예제 #4
0
파일: tests.py 프로젝트: lettertwo/sentry
    def test_invalid_validate_hmac_signature(self):
        with mock.patch('sentry.coreapi.get_signature') as get_signature:
            get_signature.return_value = 'notsignature'

            with self.assertRaises(APIForbidden):
                validate_hmac('foo', 'signature', time.time(), 'foo')
예제 #5
0
    def test_invalid_validate_hmac_bad_timestamp(self):
        with mock.patch('sentry.coreapi.get_signature') as get_signature:
            get_signature.return_value = 'signature'

            with self.assertRaises(APIError):
                validate_hmac('foo', 'signature', 'foo', 'foo')
예제 #6
0
    def test_invalid_validate_hmac_expired(self):
        with mock.patch('sentry.coreapi.get_signature') as get_signature:
            get_signature.return_value = 'signature'

            with self.assertRaises(APITimestampExpired):
                validate_hmac('foo', 'signature', time.time() - 3601, 'foo')
예제 #7
0
    def test_invalid_validate_hmac_signature(self):
        with mock.patch('sentry.coreapi.get_signature') as get_signature:
            get_signature.return_value = 'notsignature'

            with self.assertRaises(APIForbidden):
                validate_hmac('foo', 'signature', time.time(), 'foo')
예제 #8
0
    def test_valid_validate_hmac(self):
        with mock.patch('sentry.coreapi.get_signature') as get_signature:
            get_signature.return_value = 'signature'

            validate_hmac('foo', 'signature', time.time(), 'foo')