class DepartmentFactory(factory.DjangoModelFactory): id = factory.Faker('uuid4') name = FuzzyUnicode() number = fuzzy.FuzzyInteger(low=1, high=99) class Meta: model = Department
class ClubPageFactory(factory.DjangoModelFactory): name_en = FuzzyUnicode() slug = fuzzy.FuzzyText() club = factory.SubFactory(ClubFactory) class Meta: model = ClubPage
class ClubFactory(factory.DjangoModelFactory): name = FuzzyUnicode() address = factory.Faker('address') city = factory.Faker('city') state = factory.Faker('state_abbr') code = fuzzy.FuzzyText(length=4, chars=string.ascii_uppercase + string.digits) slug = fuzzy.FuzzyText(length=24) class Meta: model = Club
class UserFactory(factory.DjangoModelFactory): username = FuzzyUnicode() password = factory.PostGenerationMethodCall('set_password', 'testpass') email = factory.Faker('email') membership_number = fuzzy.FuzzyText(length=15) first_name = factory.Faker('first_name') last_name = factory.Faker('last_name') middle_name = factory.Faker('first_name') category = factory.SubFactory(UserCategoryFactory) clubcorp = factory.SubFactory(ClubCorpFactory) clubcorp_number = fuzzy.FuzzyText(length=5) customer_id = membership_number home_club = factory.SubFactory(ClubFactory) type = factory.SubFactory(UserTypeFactory) class Meta: model = User @factory.post_generation def profile(self, created, extracted, **kwargs): if extracted or extracted is None: ProfileFactory(user=self)
class UserTypeFactory(factory.DjangoModelFactory): id = fuzzy.FuzzyText(length=6) name = FuzzyUnicode() class Meta: model = UserType
class ClubCorpFactory(factory.DjangoModelFactory): id = fuzzy.FuzzyText(length=6) name = FuzzyUnicode() class Meta: model = ClubCorp