# Path: amivapi/tests/utils.py
# class WebTestNoAuth(WebTest):
#     """WebTest without authentification."""
# 
#     def setUp(self, **extra_config):
#         """Use auth hook to always authenticate as root for every request."""
#         super().setUp(**extra_config)
# 
#         def authenticate_root(resource):
#             g.resource_admin = True
# 
#         self.app.after_auth += authenticate_root
# 
# def skip_if_false(condition, reason):
#     """Decorator to mark tests to be skipped if condition is false."""
#     def _skip(func):
#         return func if condition else pytest.mark.skip(reason=reason)(func)
#     return _skip


from os import getenv
from flask.signals import got_request_exception
from amivapi.tests.utils import WebTestNoAuth, skip_if_false
import warnings
# -*- coding: utf-8 -*-
#
# license: AGPLv3, see LICENSE for details. In addition we strongly encourage
#          you to buy us beer if we meet and you like the software.
"""Sentry integration tests."""





# Get test dsn from environment
SENTRY_DSN = getenv('SENTRY_TEST_DSN')


class SentryIntegrationTest(WebTestNoAuth):
    """Raise an error to check if it gets sent to Sentry."""

    def setUp(self, *args, **kwargs):
        """Extended setUp: Move environment variables to config."""
        extra_config = {
            'SENTRY_DSN': SENTRY_DSN,
            'SENTRY_ENVIRONMENT': 'testing',
        }
        extra_config.update(kwargs)
        super().setUp(*args, **extra_config)


# Path: amivapi/tests/utils.py
# class WebTestNoAuth(WebTest):
#     """WebTest without authentification."""
# 
#     def setUp(self, **extra_config):
#         """Use auth hook to always authenticate as root for every request."""
#         super().setUp(**extra_config)
# 
#         def authenticate_root(resource):
#             g.resource_admin = True
# 
#         self.app.after_auth += authenticate_root
# 
# def skip_if_false(condition, reason):
#     """Decorator to mark tests to be skipped if condition is false."""
#     def _skip(func):
#         return func if condition else pytest.mark.skip(reason=reason)(func)
#     return _skip


# Path: amivapi/tests/test_sentry.py
from os import getenv
from flask.signals import got_request_exception
from amivapi.tests.utils import WebTestNoAuth, skip_if_false
import warnings

# -*- coding: utf-8 -*-
#
# license: AGPLv3, see LICENSE for details. In addition we strongly encourage
#          you to buy us beer if we meet and you like the software.
"""Sentry integration tests."""





# Get test dsn from environment
SENTRY_DSN = getenv('SENTRY_TEST_DSN')


class SentryIntegrationTest(WebTestNoAuth):
    """Raise an error to check if it gets sent to Sentry."""

    def setUp(self, *args, **kwargs):
        """Extended setUp: Move environment variables to config."""
        extra_config = {
            'SENTRY_DSN': SENTRY_DSN,
            'SENTRY_ENVIRONMENT': 'testing',
        }
        extra_config.update(kwargs)
        super().setUp(*args, **extra_config)


    @skip_if_false(SENTRY_DSN, "Sentry test requires environment variable "