Ejemplo n.º 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')
Ejemplo n.º 2
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')
Ejemplo n.º 3
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')
Ejemplo n.º 4
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')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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')