improved unit factory and run CI on PR

This commit is contained in:
vabene1111 2023-01-16 21:20:16 +01:00
parent 97bcf1111b
commit 274b17a860
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
name: Continuous Integration name: Continuous Integration
on: [push] on: [push, pull_request]
jobs: jobs:
build: build:

View File

@ -97,7 +97,7 @@ class SupermarketCategoryFactory(factory.django.DjangoModelFactory):
@register @register
class FoodFactory(factory.django.DjangoModelFactory): class FoodFactory(factory.django.DjangoModelFactory):
"""Food factory.""" """Food factory."""
name = factory.LazyAttribute(lambda x: faker.sentence(nb_words=3, variable_nb_words=False)) name = factory.LazyAttribute(lambda x: faker.sentence(nb_words=10)[:128])
plural_name = factory.LazyAttribute(lambda x: faker.sentence(nb_words=3, variable_nb_words=False)) plural_name = factory.LazyAttribute(lambda x: faker.sentence(nb_words=3, variable_nb_words=False))
description = factory.LazyAttribute(lambda x: faker.sentence(nb_words=10)) description = factory.LazyAttribute(lambda x: faker.sentence(nb_words=10))
supermarket_category = factory.Maybe( supermarket_category = factory.Maybe(
@ -160,7 +160,7 @@ class RecipeBookEntryFactory(factory.django.DjangoModelFactory):
@register @register
class UnitFactory(factory.django.DjangoModelFactory): class UnitFactory(factory.django.DjangoModelFactory):
"""Unit factory.""" """Unit factory."""
name = factory.LazyAttribute(lambda x: faker.word()) name = factory.LazyAttribute(lambda x: faker.sentence(nb_words=10)[:128])
plural_name = factory.LazyAttribute(lambda x: faker.word()) plural_name = factory.LazyAttribute(lambda x: faker.word())
description = factory.LazyAttribute(lambda x: faker.sentence(nb_words=10)) description = factory.LazyAttribute(lambda x: faker.sentence(nb_words=10))
space = factory.SubFactory(SpaceFactory) space = factory.SubFactory(SpaceFactory)