Example #1
0
class BillingTypeFactory(DjangoModelFactory):
    name = Faker("currency_name")
    reference = None

    class Meta:
        model = models.BillingType
 def set_image(self, create, extracted, **kwargs):
     if settings.USE_CLOUDINARY:
         self.cloudinary_image = Faker('product_image').generate({})
     else:
         self.image.name = Faker('product_image').generate({})
class OLTPBenchDBFactory(DjangoModelFactory):
    class Meta:
        model = OLTPBenchResult
        django_get_or_create = ('git_branch', 'git_commit_id',)

    time = LazyAttribute(lambda _: datetime.now(timezone.utc).isoformat())
    query_mode = Faker('random_element', elements=('simple', 'extended'))
    jenkins_job_id = Faker('pystr_format', string_format='###')
    git_branch = Faker('word')
    git_commit_id = Faker('sha1')
    db_version = Faker('word')
    environment = Faker('pydict', value_types=[str])
    benchmark_type = Faker('word')
    scale_factor = Faker('pyfloat', left_digits=6,
                         right_digits=4, positive=True)
    terminals = Faker('random_int', min=1, max=32)
    client_time = Faker('random_int', min=30, step=30)
    weights = Faker('pydict', value_types=[int])
    wal_device = Faker('random_element', elements=('RAM disk', 'HDD', 'SATA SSD', 'NVMe SSD', 'None'))
    max_connection_threads = Faker('random_int', min=1, max=32)
    metrics = Dict({
        'throughput': Faker('pyfloat', positive=True),
        'latency': Faker('pydict', value_types=[float])
    })
    incremental_metrics = Faker('pydict', value_types=[int, float, str])
Example #4
0
class MetagenomeAssemblyFactory(PipelineStepBase):
    class Meta:
        model = models.MetagenomeAssembly
        sqlalchemy_session = db

    scaffolds: int = Faker("pyint")
    contigs: int = Faker("pyint")
    scaf_bp: int = Faker("pyint")
    contig_bp: int = Faker("pyint")
    scaf_N50: int = Faker("pyint")
    scaf_L50: int = Faker("pyint")
    ctg_N50: int = Faker("pyint")
    ctg_L50: int = Faker("pyint")
    scaf_N90: int = Faker("pyint")
    scaf_L90: int = Faker("pyint")
    ctg_N90: int = Faker("pyint")
    ctg_L90: int = Faker("pyint")
    scaf_max: int = Faker("pyint")
    ctg_max: int = Faker("pyint")
    scaf_n_gt50K: int = Faker("pyint")
    scaf_l_gt50k: int = Faker("pyint")
    scaf_pct_gt50K: int = Faker("pyint")
    num_input_reads: int = Faker("pyint")
    num_aligned_reads: int = Faker("pyint")
    scaf_logsum: float = Faker("pyfloat")
    scaf_powsum: float = Faker("pyfloat")
    ctg_logsum: float = Faker("pyfloat")
    ctg_powsum: float = Faker("pyfloat")
    asm_score: float = Faker("pyfloat")
    gap_pct: float = Faker("pyfloat")
    gc_avg: float = Faker("pyfloat")
    gc_std: float = Faker("pyfloat")
Example #5
0
class GeneFunction(SQLAlchemyModelFactory):
    class Meta:
        model = models.GeneFunction
        sqlalchemy_session = db

    id: str = Faker("pystr")
Example #6
0
class PostalUnitFactory(Factory):
    class Meta:
        model = PostalUnit

    code = faker.Faker("random_number", digits=4)
    description = Faker("company", locale="pt_BR")
Example #7
0
class GroupFactory(DjangoModelFactory):
    class Meta:
        model = Group

    name = Faker('name')
from factory.django import DjangoModelFactory
from wagtail_factories import PageFactory
from factory import (Faker, LazyAttribute)
from networkapi.utility.faker import StreamfieldProvider

streamfield_fields = [
    'header', 'paragraph', 'image', 'spacer', 'image_text', 'quote'
]

sentence_faker: Faker = Faker('sentence', nb_words=3, variable_nb_words=False)
header_faker: Faker = Faker('sentence', nb_words=6, variable_nb_words=True)
description_faker: Faker = Faker('paragraphs', nb=2)
name_and_header = LazyAttribute(lambda o: o.header_text.rstrip('.'))

Faker.add_provider(StreamfieldProvider)


class CTAFactory(DjangoModelFactory):
    class Meta:
        abstract = True
        exclude = (
            'header_text',
            'description_text',
        )

    name = name_and_header
    header = name_and_header
    description = LazyAttribute(
        lambda o: ''.join([f'<p>{p}</p>' for p in o.description_text]))
    newsletter = Faker('word')
Example #9
0
class FileFactory(DjangoModelFactory):
    name = Faker("file_name")

    class Meta:
        model = models.File
Example #10
0
 def set_image(self, create, extracted, **kwargs):
     self.image.name = Faker('generic_image').generate({})
class ProductPrivacyPolicyLinkFactory(DjangoModelFactory):
    class Meta:
        model = ProductPrivacyPolicyLink

    label = Faker('sentence')
    url = Faker('url')
Example #12
0
class GroupFactory(DjangoModelFactory):
    class Meta:
        model = Group

    name = Faker("sentence", locale="es_ES", nb_words=4, variable_nb_words=True, ext_word_list=None)
Example #13
0
class ResourceFactory(DjangoModelFactory):
    """Factory for generating resources."""

    name = Faker('sentence')
    description = Faker('paragraph', nb_sentences=5)
    published = True

    class Meta:
        """Metadata for class."""

        model = Resource

    @post_generation
    def add_detail(self, create, extracted, **kwargs):
        """Add detail to resource."""
        FAKER = faker.Faker()

        # Set language
        # 25% chance both languages, otherwise one
        if random.randint(1, 4) == 1:
            self.languages.add(*Language.objects.all())
        else:
            self.languages.add(random.choice(Language.objects.all()))

        # Set technological areas
        # 20% chance both, otherwise one
        if random.randint(1, 5) == 1:
            self.technological_areas.add(*TechnologicalArea.objects.all())
        else:
            self.technological_areas.add(
                random.choice(TechnologicalArea.objects.all()))

        # Choose primary (45%), secondary (45%), both (10%) for rest of variables
        if random.randint(1, 10) == 1:
            resource_detail_content = CONTENT_BOTH
            self.year_levels.add(*random.sample(list(YearLevel.objects.all()),
                                                random.randint(1, 4)))
        elif random.randint(1, 2) == 1:
            resource_detail_content = CONTENT_PRIMARY
            self.year_levels.add(
                *random.sample(list(YearLevel.objects.filter(
                    level__lte=8)), random.randint(1, 4)))
        else:
            resource_detail_content = CONTENT_SECONDARY
            self.year_levels.add(
                *random.sample(list(YearLevel.objects.filter(
                    level__gte=9)), random.randint(1, 4)))

        # Add progress outcomes
        if resource_detail_content in [CONTENT_BOTH, CONTENT_PRIMARY]:
            self.progress_outcomes.add(*random.sample(
                list(
                    ProgressOutcome.objects.filter(
                        technological_area__in=self.technological_areas.all())
                ), random.randint(1, 3)))

        # Add NZQA standards
        if resource_detail_content in [CONTENT_BOTH, CONTENT_SECONDARY]:
            self.nzqa_standards.add(*random.sample(
                list(NZQAStandard.objects.all()), random.randint(1, 3)))

        # Add curriculum learning areas
        self.curriculum_learning_areas.add(*random.sample(
            list(CurriculumLearningArea.objects.all()), random.randint(0, 2)))

        # Add components
        number_of_components = random.randint(1, 9)
        for i in range(number_of_components):

            component_name = FAKER.sentence()
            component_type = random.choice(
                list(ResourceComponent.COMPONENT_TYPE_DATA))
            resource_count = Resource.objects.count()

            if component_type == ResourceComponent.TYPE_RESOURCE and resource_count >= 2:
                resources = list(Resource.objects.exclude(pk=self.pk))
                resource_component = resources[random.randint(
                    0,
                    len(resources) - 1)]
                ResourceComponent.objects.create(
                    name=resource_component.name,
                    resource=self,
                    component_resource=resource_component,
                )
            # TODO: Implement all types of components
            else:  # Website
                ResourceComponent.objects.create(
                    name=component_name,
                    resource=self,
                    component_url=FAKER.url(),
                )
Example #14
0
class CostCenterFactory(DjangoModelFactory):
    name = Faker("job")
    reference = None

    class Meta:
        model = models.CostCenter
Example #15
0
class SiteConfigurationFactory(django.DjangoModelFactory):
    class Meta:
        model = SiteConfiguration

    site = SubFactory(SiteFactory)
    lms_url_root = Faker('url')
    catalog_api_url = Faker('url')
    platform_name = Faker('word')
    partner_from_address = Faker('safe_email')
    tos_url = Faker('url')
    privacy_policy_url = Faker('url')
    homepage_url = Faker('url')
    company_name = Faker('word')
    certificate_help_url = Faker('url')
    records_help_url = Faker('url')
    twitter_username = Faker('word')
Example #16
0
class ProductFactory(DjangoModelFactory):
    class Meta:
        model = Product
        exclude = ('product_words')

    product_words = Faker('words', nb=2)

    draft = Faker('boolean')
    adult_content = Faker('boolean')
    name = LazyAttribute(lambda o: ' '.join(o.product_words))

    @post_generation
    def product_category(self, create, extracted, **kwargs):
        """
        After model generation, Relate this product to one or more product categories.
        Do this in a way that will assign some products 2 or more categories.
        """
        ceiling = 1.0
        while True:
            odds = random()
            if odds < ceiling:
                category = choice(BuyersGuideProductCategory.objects.all())
                self.product_category.add(category)
                ceiling = ceiling / 5
            else:
                return

    company = Faker('company')
    blurb = Faker('sentence')
    url = Faker('url')
    price = LazyAttribute(lambda _: randint(49, 1500))
    camera_app = Faker('boolean')
    meets_minimum_security_standards = Faker('boolean')
    camera_device = Faker('boolean')
    microphone_app = Faker('boolean')
    microphone_device = Faker('boolean')
    location_app = Faker('boolean')
    location_device = Faker('boolean')
    uses_encryption = Faker('boolean')
    privacy_policy_reading_level_url = Faker('url')
    privacy_policy_reading_level = LazyAttribute(lambda _: str(randint(7, 15)))
    share_data = Faker('boolean')
    must_change_default_password = Faker('boolean')
    security_updates = Faker('boolean')
    delete_data = Faker('boolean')
    child_rules = Faker('boolean')
    manage_security = Faker('boolean')
    phone_number = Faker('phone_number')
    live_chat = Faker('url')
    email = Faker('email')
    worst_case = Faker('sentence')

    @post_generation
    def set_image(self, create, extracted, **kwargs):
        if settings.USE_CLOUDINARY:
            self.cloudinary_image = Faker('product_image').generate({})
        else:
            self.image.name = Faker('product_image').generate({})
Example #17
0
class RecipeFactory(DjangoModelFactory):
    paprika_account = SubFactory(PaprikaAccountFactory)
    # categories = SubFactory(CategoryFactory)
    uid = Faker('uuid4')
    date_ended = None
    hash = Faker('uuid4')
    photo_hash = Faker('uuid4')
    name = Faker('name')
    photo_url = Faker('uri')
    ingredients = Faker('paragraph')
    source = Faker('company')
    total_time = Faker('sentence')
    cook_time = Faker('sentence')
    prep_time = Faker('sentence')
    created = Faker('date_time')
    description = Faker('paragraph')
    source_url = Faker('uri')
    difficulty = Faker('word')
    directions = Faker('paragraph')
    notes = Faker('paragraph')
    nutritional_info = Faker('paragraph')
    servings = Faker('word')
    rating = Faker('pyint', min_value=0, max_value=5)
    on_favorites = Faker('pybool')
    in_trash = False

    class Meta:
        model = Recipe

    @factory.post_generation
    def categories(self, create, extracted, **kwargs):
        if not create:
            # Simple build, do nothing.
            return

        if extracted:
            # A list of categories were passed in, use them
            for category in extracted:
                self.categories.add(category)
        else:
            self.categories.add(
                CategoryFactory(paprika_account=self.paprika_account))
    def handle(self, *args, **options):
        try:
            User.objects.get(username='******')
            print('super user already exists')
        except ObjectDoesNotExist:
            password = Faker(
                'password',
                length=16,
                special_chars=True,
                digits=True,
                upper_case=True,
                lower_case=True
            ).generate({})
            User.objects.create_superuser('admin', '*****@*****.**', password)

            pr_number = settings.HEROKU_PR_NUMBER
            reviewapp_name = settings.HEROKU_APP_NAME
            branch_name = settings.HEROKU_BRANCH

            # Review apps created when opening a PR
            if pr_number:
                # Get PR's title from Github
                token = settings.GITHUB_TOKEN
                org = 'mozilla'
                repo = 'donate-wagtail'
                headers = {'Authorization': f'token {token}'}
                r = requests.get(f'https://api.github.com/repos/{org}/{repo}/pulls/{pr_number}', headers=headers)
                r.raise_for_status()
                try:
                    pr_title = ' - ' + r.json()['title']
                except KeyError:
                    pr_title = ''

                for label in r.json()['labels']:
                    if label['name'] == 'dependencies':
                        pre_title = ':robot_face: *[Dependabot]*'
                        break
                else:
                    pre_title = ':computer: *[Devs]*'
                message_title = f'*PR {pr_number}{pr_title}*\n'
                github_url = f'https://github.com/mozilla/donate-wagtail/pull/{pr_number}'
                github_button_text = 'View PR on Github'

            # Review apps created from Heroku to deploy a branch
            else:
                pre_title = ':computer: *[Devs]*'
                message_title = f'*Branch: {branch_name}*\n'
                github_url = f'https://github.com/mozilla/donate-wagtail/tree/{branch_name}'
                github_button_text = 'View branch on Github'

            slack_payload = {
                'blocks': [
                    {
                        'type': 'section',
                        'text': {
                            'type': 'mrkdwn',
                            'text': f'{pre_title} {message_title}'
                                    'This new review app will be ready in a minute!\n'
                                    '*Login:* admin\n'
                                    f'*Password:* {password}\n'
                        }
                    },
                    {
                        'type': 'actions',
                        'elements': [
                            {
                                'type': 'button',
                                'text': {
                                    'type': 'plain_text',
                                    'text': 'View review app'
                                },
                                'url': f'https://{reviewapp_name}.herokuapp.com'
                            },
                            {
                                'type': 'button',
                                'text': {
                                    'type': 'plain_text',
                                    'text': f'{github_button_text}',
                                },
                                'url': f'{github_url}'
                            }
                        ]
                    },
                    {
                        'type': 'divider',
                    }
                ]
            }

            slack_webhook = settings.SLACK_WEBHOOK_RA
            r = requests.post(f'{slack_webhook}',
                              json=slack_payload,
                              headers={'Content-Type': 'application/json'}
                              )

            # Raise if post request was a 4xx or 5xx
            r.raise_for_status()
            print('Done!')
Example #19
0
class UserFactory(DjangoModelFactory):
    class Meta:
        model = User

    username = Faker('user_name')
Example #20
0
class ProductPageFactory(PageFactory):

    class Meta:
        model = ProductPage

    title = Faker('sentence')

    privacy_ding = Faker('boolean')
    adult_content = Faker('boolean')
    uses_wifi = Faker('boolean')
    uses_bluetooth = Faker('boolean')
    company = Faker('company')
    blurb = Faker('sentence')
    product_url = Faker('url')
    price = LazyAttribute(lambda _: randint(49, 1500))
    worst_case = Faker('sentence')
    first_published_at = Faker('past_datetime', start_date='-2d', tzinfo=timezone.utc)
    last_published_at = Faker('past_datetime', start_date='-1d', tzinfo=timezone.utc)

    @post_generation
    def set_image(self, create, extracted, **kwargs):
        self.image = ImageFactory()

    @post_generation
    def assign_random_categories(self, create, extracted, **kwargs):
        # late import to prevent circular dependency
        from networkapi.wagtailpages.models import ProductPageCategory
        ceiling = 1.0
        while True:
            odds = random()
            if odds < ceiling:
                category = get_lowest_content_page_category()
                ProductPageCategory.objects.get_or_create(
                    product=self,
                    category=category
                )
                ceiling = ceiling / 5
            else:
                return

    @post_generation
    def set_random_review_date(self, create, extracted, **kwargs):
        if "Percy" not in self.title:
            start_date = date(2020, 10, 1)
            end_date = date(2021, 1, 30)
            time_between_dates = end_date - start_date
            days_between_dates = time_between_dates.days
            random_number_of_days = randrange(days_between_dates)
            self.review_date = start_date + timedelta(days=random_number_of_days)

    @post_generation
    def set_random_creepiness(self, create, extracted, **kwargs):
        self.get_or_create_votes()
        single_vote = [0, 0, 0, 0, 1]
        shuffle(single_vote)
        self.votes.set_votes(single_vote)
        self.creepiness_value = randint(0, 100)
Example #21
0
class BiosampleFactory(AnnotatedFactory):
    class Meta:
        model = models.Biosample
        sqlalchemy_session = db

    add_date = Faker("date_time")
    mod_date = Faker("date_time")
    collection_date = Faker("date_time")
    depth = Faker("random_number", digits=3)
    env_broad_scale = SubFactory(EnvoTermFactory)
    env_local_scale = SubFactory(EnvoTermFactory)
    env_medium = SubFactory(EnvoTermFactory)
    latitude = Faker("latitude")
    longitude = Faker("longitude")
    study = SubFactory(StudyFactory)
    ecosystem = Faker("word")
    ecosystem_category = Faker("word")
    ecosystem_type = Faker("word")
    ecosystem_subtype = Faker("word")
    specific_ecosystem = Faker("word")
Example #22
0
class GeneralProductPageFactory(ProductPageFactory):

    class Meta:
        model = GeneralProductPage

    camera_app = LazyFunction(get_extended_yes_no_value)
    camera_device = LazyFunction(get_extended_yes_no_value)
    microphone_app = LazyFunction(get_extended_yes_no_value)
    microphone_device = LazyFunction(get_extended_yes_no_value)
    location_app = LazyFunction(get_extended_yes_no_value)
    location_device = LazyFunction(get_extended_yes_no_value)
    personal_data_collected = Faker('sentence')
    biometric_data_collected = Faker('sentence')
    social_data_collected = Faker('sentence')
    how_can_you_control_your_data = Faker('sentence')
    data_control_policy_is_bad = Faker('boolean')
    company_track_record = get_random_option(['Great', 'Average', 'Needs Improvement', 'Bad'])
    track_record_is_bad = Faker('boolean')
    track_record_details = Faker('sentence')
    offline_capable = LazyFunction(get_extended_yes_no_value)
    offline_use_description = Faker('sentence')
    uses_ai = LazyFunction(get_extended_yes_no_value)
    ai_uses_personal_data = LazyFunction(get_extended_yes_no_value)
    ai_is_transparent = LazyFunction(get_extended_yes_no_value)
    ai_helptext = Faker('sentence')
    email = Faker('email')
    live_chat = Faker('url')
    phone_number = Faker('phone_number')
    twitter = '@TwitterHandle'
Example #23
0
class NOMAnalysisFactory(PipelineStepBase):
    class Meta:
        model = models.NOMAnalysis
        sqlalchemy_session = db

    used: str = Faker("word")
Example #24
0
class SoftwareProductPageFactory(ProductPageFactory):

    class Meta:
        model = SoftwareProductPage

    price = 0

    handles_recordings_how = Faker('sentence')
    recording_alert = LazyFunction(get_extended_yes_no_value)
    recording_alert_helptext = Faker('sentence')
    medical_privacy_compliant = Faker('boolean')
    medical_privacy_compliant_helptext = Faker('sentence')
    host_controls = Faker('sentence')
    easy_to_learn_and_use = Faker('boolean')
    easy_to_learn_and_use_helptext = Faker('sentence')
    handles_recordings_how = Faker('sentence')
    recording_alert = LazyFunction(get_extended_yes_no_value)
    recording_alert_helptext = Faker('sentence')
    medical_privacy_compliant = Faker('boolean')
    medical_privacy_compliant_helptext = Faker('sentence')
    host_controls = Faker('sentence')
    easy_to_learn_and_use = Faker('boolean')
    easy_to_learn_and_use_helptext = Faker('sentence')
class ProductFactory(DjangoModelFactory):
    class Meta:
        model = Product
        exclude = ('product_words')

    product_words = Faker('words', nb=2)

    draft = Faker('boolean')
    adult_content = Faker('boolean')
    review_date = Faker('date_time_between_dates',
                        datetime_start=date(year=2018, month=11, day=1),
                        datetime_end=None,
                        tzinfo=timezone.utc)
    name = LazyAttribute(lambda o: ' '.join(o.product_words))

    @post_generation
    def product_category(self, create, extracted, **kwargs):
        """
        After model generation, Relate this product to one or more product categories.
        Do this in a way that will assign some products 2 or more categories.
        """
        ceiling = 1.0
        while True:
            odds = random()
            if odds < ceiling:
                category = choice(BuyersGuideProductCategory.objects.all())
                self.product_category.add(category)
                ceiling = ceiling / 5
            else:
                return

    blurb = Faker('sentence')

    camera_app = LazyFunction(get_extended_yes_no_value)
    camera_device = LazyFunction(get_extended_yes_no_value)
    microphone_app = LazyFunction(get_extended_yes_no_value)
    microphone_device = LazyFunction(get_extended_yes_no_value)
    location_app = LazyFunction(get_extended_yes_no_value)
    location_device = LazyFunction(get_extended_yes_no_value)

    company = Faker('company')
    delete_data = Faker('boolean')
    email = Faker('email')
    live_chat = Faker('url')
    manage_vulnerabilities = LazyFunction(get_extended_yes_no_value)
    meets_minimum_security_standards = Faker('boolean')
    parental_controls = LazyFunction(get_extended_yes_no_value)
    phone_number = Faker('phone_number')
    price = LazyAttribute(lambda _: randint(49, 1500))
    privacy_policy_reading_level = LazyAttribute(lambda _: str(randint(7, 15)))
    privacy_policy_reading_level_url = Faker('url')
    security_updates = LazyFunction(get_extended_yes_no_value)
    share_data = Faker('boolean')
    strong_password = LazyFunction(get_extended_yes_no_value)
    url = Faker('url')
    uses_encryption = LazyFunction(get_extended_yes_no_value)
    worst_case = Faker('sentence')

    @post_generation
    def set_image(self, create, extracted, **kwargs):
        if settings.USE_CLOUDINARY:
            self.cloudinary_image = Faker('product_image').generate({})
        else:
            self.image.name = Faker('product_image').generate({})
class CreatorFactory(DjangoModelFactory):
    class Meta:
        model = Creator

    name = Faker('name')
Example #27
0
 def test_create(self):
     """ Test creation """
     order = OrderFactory(start_date=Faker("past_date"),
                          end_date=Faker("future_date"))
     self.assertTrue(order)
Example #28
0
class SiteFactory(django.DjangoModelFactory):
    class Meta:
        model = Site

    domain = Faker('domain_name')
    name = Faker('word')
Example #29
0
class AddressFactory(Factory):
    class Meta:
        model = Address

    name = Faker("name", locale="pt_BR")
    street = Faker("street_name", locale="pt_BR")
    number = Faker("building_number", locale="pt_BR")
    city = Faker("city", locale="pt_BR")
    state = Faker("estado_sigla", locale="pt_BR")
    zip_code = "07192-100"
    complement = Faker("secondary_address")
    neighborhood = Sequence(lambda n: "Neighborhood #{}".format(n))
    phone = Faker("phone_number", locale="pt_BR")
    cellphone = Faker("phone_number", locale="pt_BR")
    email = Faker("email")
    latitude = Faker("latitude", locale="pt_BR")
    longitude = Faker("longitude", locale="pt_BR")
class ActivityFactory(DjangoModelFactory):
    class Meta:
        model = Activity
        exclude = ("active", "now")

    # Helper fields
    active = Faker("boolean")
    now = timezone.now()

    union = SubFactory(UnionFactory)
    department = SubFactory(DepartmentFactory,
                            union=factory.SelfAttribute("..union"))
    name = Faker("activity")
    open_hours = Faker("numerify", text="kl. ##:00-##:00")
    responsible_name = Faker("name")
    responsible_contact = Faker("email")
    placename = Faker("city_suffix")
    zipcode = Faker("zipcode")
    city = Faker("city")
    streetname = Faker("street_name")
    housenumber = Faker("building_number")
    floor = Faker("floor")
    door = Faker("door")
    dawa_id = Faker("uuid4")
    description = Faker("text")
    instructions = Faker("text")
    signup_closing = Faker("date_time_between",
                           tzinfo=TIMEZONE,
                           start_date="-100d",
                           end_date="+100d")
    start_date = LazyAttribute(
        lambda d: datetime_before(d.now)
        if d.active else Faker("date_time", tzinfo=TIMEZONE).generate({}))
    end_date = LazyAttribute(lambda d: datetime_after(d.now)
                             if d.active else datetime_before(d.now))
    updated_dtm = Faker("date_time", tzinfo=TIMEZONE)
    open_invite = Faker("boolean")
    price_in_dkk = Faker("random_number", digits=4)
    max_participants = Faker("random_number")
    min_age = Faker("random_int", min=5, max=18)
    max_age = LazyAttribute(
        lambda a: a.min_age + Faker("random_int", min=10, max=80).generate({}))
    member_justified = Faker("boolean")