# Path: amivapi/settings.py
# EMAIL_REGEX = '^.+@.+$'
# 
# REDIRECT_URI_REGEX = '^((http://)?localhost[^#]*|https://[^#]+)$'
# 
# Path: amivapi/utils.py
# @contextmanager
# def admin_permissions():
#     """Switch to a context with admin rights and restore state afterwards.
# 
#     Use as context:
#     >> with admin_rights():
#     >>     do_something()
#     """
#     old_admin = g.get('resource_admin')
#     g.resource_admin = True
# 
#     yield
# 
#     if old_admin is not None:  # None means it wasn't set before..
#         g.resource_admin = old_admin


from datetime import date, datetime, timedelta
from os.path import dirname, join
from contextlib import contextmanager
from bson import ObjectId
from eve.methods.post import post_internal
from werkzeug.datastructures import FileStorage
from amivapi.settings import EMAIL_REGEX, REDIRECT_URI_REGEX
from amivapi.utils import admin_permissions
import random
import string
                random.choice(schema['permissions']['valuesrules']['allowed']))

            obj['permissions'] = {resource: permission}

    def preprocess_events(self, schema, obj, fixture):
        """Event validators are pretty complex, so do all thing with custom
        validators by hand"""
        # Add either german or englisch texts
        if random.choice([True, False]):
            obj.setdefault(
                'title_de',
                self.create_random_value(schema['title_de']))
            obj.setdefault(
                'catchphrase_de',
                self.create_random_value(schema['catchphrase_de']))
            obj.setdefault(
                'description_de',
                self.create_random_value(schema['description_de']))
        else:
            obj.setdefault(
                'title_en',
                self.create_random_value(schema['title_en']))
            obj.setdefault(
                'catchphrase_en',
                self.create_random_value(schema['catchphrase_en']))
            obj.setdefault(
                'description_en',
                self.create_random_value(schema['description_en']))

        # fullfill earlier_than and later_than validators

# Path: amivapi/settings.py
# EMAIL_REGEX = '^.+@.+$'
# 
# REDIRECT_URI_REGEX = '^((http://)?localhost[^#]*|https://[^#]+)$'
# 
# Path: amivapi/utils.py
# @contextmanager
# def admin_permissions():
#     """Switch to a context with admin rights and restore state afterwards.
# 
#     Use as context:
#     >> with admin_rights():
#     >>     do_something()
#     """
#     old_admin = g.get('resource_admin')
#     g.resource_admin = True
# 
#     yield
# 
#     if old_admin is not None:  # None means it wasn't set before..
#         g.resource_admin = old_admin


# Path: amivapi/tests/fixtures.py
from datetime import date, datetime, timedelta
from os.path import dirname, join
from contextlib import contextmanager
from bson import ObjectId
from eve.methods.post import post_internal
from werkzeug.datastructures import FileStorage
from amivapi.settings import EMAIL_REGEX, REDIRECT_URI_REGEX
from amivapi.utils import admin_permissions
import random
import string

                random.choice(schema['permissions']['valuesrules']['allowed']))

            obj['permissions'] = {resource: permission}

    def preprocess_events(self, schema, obj, fixture):
        """Event validators are pretty complex, so do all thing with custom
        validators by hand"""
        # Add either german or englisch texts
        if random.choice([True, False]):
            obj.setdefault(
                'title_de',
                self.create_random_value(schema['title_de']))
            obj.setdefault(
                'catchphrase_de',
                self.create_random_value(schema['catchphrase_de']))
            obj.setdefault(
                'description_de',
                self.create_random_value(schema['description_de']))
        else:
            obj.setdefault(
                'title_en',
                self.create_random_value(schema['title_en']))
            obj.setdefault(
                'catchphrase_en',
                self.create_random_value(schema['catchphrase_en']))
            obj.setdefault(
                'description_en',
                self.create_random_value(schema['description_en']))

        # fullfill earlier_than and later_than validators

        obj['time_advertising_start'] = (