# 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


from bson import ObjectId
from amivapi.tests.utils import WebTestNoAuth
"""Test for cascading deletes"""




class CascadingDeleteTest(WebTestNoAuth):

    def test_delete_cascades(self):
        """Test that deletion of an object deletes referencing objects, when
        cascading is enabled"""

        self.load_fixture({
            'users': [
                {
                    '_id': 'deadbeefdeadbeefdeadbeef',
                    'nethz': 'user1'
                },
                {
                    '_id': 'deadbeefdeadbeefdeadbee3',
                    'nethz': 'user2'
                }
            ],
            'sessions': [
                {
                    '_id': 'deadbeefdeadbeefdeadbee2',
                    'username': 'user1'
                },
                {
                    '_id': 'deadbeefdeadbeefdeadbee1',
                    'username': 'user2'

# 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


# Path: amivapi/tests/test_cascade_delete.py
from bson import ObjectId
from amivapi.tests.utils import WebTestNoAuth

"""Test for cascading deletes"""




class CascadingDeleteTest(WebTestNoAuth):

    def test_delete_cascades(self):
        """Test that deletion of an object deletes referencing objects, when
        cascading is enabled"""

        self.load_fixture({
            'users': [
                {
                    '_id': 'deadbeefdeadbeefdeadbeef',
                    'nethz': 'user1'
                },
                {
                    '_id': 'deadbeefdeadbeefdeadbee3',
                    'nethz': 'user2'
                }
            ],
            'sessions': [
                {
                    '_id': 'deadbeefdeadbeefdeadbee2',
                    'username': 'user1'
                },
                {
                    '_id': 'deadbeefdeadbeefdeadbee1',
                    'username': 'user2'

                }