示例#1
0
class DepartmentFactory(factory.DjangoModelFactory):
    id = factory.Faker('uuid4')
    name = FuzzyUnicode()
    number = fuzzy.FuzzyInteger(low=1, high=99)

    class Meta:
        model = Department
示例#2
0
class ClubPageFactory(factory.DjangoModelFactory):
    name_en = FuzzyUnicode()
    slug = fuzzy.FuzzyText()
    club = factory.SubFactory(ClubFactory)

    class Meta:
        model = ClubPage
示例#3
0
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
示例#4
0
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)
示例#5
0
class UserTypeFactory(factory.DjangoModelFactory):
    id = fuzzy.FuzzyText(length=6)
    name = FuzzyUnicode()

    class Meta:
        model = UserType
示例#6
0
class ClubCorpFactory(factory.DjangoModelFactory):
    id = fuzzy.FuzzyText(length=6)
    name = FuzzyUnicode()

    class Meta:
        model = ClubCorp