# 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 datetime import timedelta
from freezegun import freeze_time
from amivapi.tests.utils import WebTestNoAuth
import re
                             status_code=200).json
        self.assertEqual(event['signup_count'], 11)
        self.assertEqual(event['unaccepted_count'], 0)

        # Add 90 signups
        self.load_fixture({'users': [{} for _ in range(90)],
                           'eventsignups': [{} for _ in range(90)]})
        event = self.api.get('events/%s' % event['_id'],
                             status_code=200).json
        self.assertEqual(event['signup_count'], 100)
        self.assertEqual(event['unaccepted_count'], 1)

    def test_signuplist_position_projection(self):
        """Test that signup list position is correctly inserted into a
        signup information"""
        with freeze_time("2016-01-01 00:00:00") as frozen_time:
            # Create a new event
            event = self.new_object('events', spots=3,
                                    selection_strategy='fcfs')

            # Add 3 signups
            for _ in range(3):
                user = self.new_object('users')
                self.api.post('/eventsignups', data={
                    'event': str(event['_id']),
                    'user': str(user['_id'])
                }, status_code=201)
                frozen_time.tick(delta=timedelta(seconds=1))

            # Check that the number of signups on that event is correct

# 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/events/test_projections.py
from datetime import timedelta
from freezegun import freeze_time
from amivapi.tests.utils import WebTestNoAuth
import re

                             status_code=200).json
        self.assertEqual(event['signup_count'], 11)
        self.assertEqual(event['unaccepted_count'], 0)

        # Add 90 signups
        self.load_fixture({'users': [{} for _ in range(90)],
                           'eventsignups': [{} for _ in range(90)]})
        event = self.api.get('events/%s' % event['_id'],
                             status_code=200).json
        self.assertEqual(event['signup_count'], 100)
        self.assertEqual(event['unaccepted_count'], 1)

    def test_signuplist_position_projection(self):
        """Test that signup list position is correctly inserted into a
        signup information"""
        with freeze_time("2016-01-01 00:00:00") as frozen_time:
            # Create a new event
            event = self.new_object('events', spots=3,
                                    selection_strategy='fcfs')

            # Add 3 signups
            for _ in range(3):
                user = self.new_object('users')
                self.api.post('/eventsignups', data={
                    'event': str(event['_id']),
                    'user': str(user['_id'])
                }, status_code=201)
                frozen_time.tick(delta=timedelta(seconds=1))

            # Check that the number of signups on that event is correct

            event = self.api.get('events/%s' % event['_id'],