Esempio n. 1
0
class InstallmentPlanFactory(ZoopObjectFactory):
    class Meta:
        model = InstallmentPlan

    mode = Faker("random_element",
                 elements=InstallmentPlan.INSTALLMENT_PLAN_MODES)
    number_installments = Faker("pyint", min_value=1, max_value=12, step=1)
Esempio n. 2
0
class ExchangeFactory(DjangoModelFactory):
    exchange_id = Faker("pystr")
    website = Faker("url")
    name = Faker("name")

    class Meta:
        model = Exchange
Esempio n. 3
0
class UserFactory(factory.DjangoModelFactory):
    class Meta:
        model = 'authentication.User'

    username = factory.sequence(lambda i: f'user_{i}')
    first_name = Faker('first_name')
    last_name = Faker('last_name')
    email = Faker('email')
Esempio n. 4
0
class SymbolFactory(DjangoModelFactory):
    id = Faker("pystr")
    asset_id_base = SubFactory(AssetFactory)
    asset_id_quote = SubFactory(AssetFactory)
    exchange = SubFactory(ExchangeFactory)
    price = Faker("pydecimal", left_digits=10, right_digits=4, positive=True, min_value=0.0)

    class Meta:
        model = Symbol
Esempio n. 5
0
class TicketPurchaseFactory(DjangoModelFactory):
    name = Faker("name")
    email = Faker("email")
    phone = Faker("phone_number")

    ticket = SubFactory(TicketFactory)

    class Meta:
        model = TicketPurchase
class PartnerFactory(Factory):
    class Meta:
        model = PartnerModel

    _id = FuzzyText(length=21)
    trading_name = Faker("name")
    owner_name = Faker("name")
    document = FuzzyText(length=15)
    coverageArea = SubFactory(CoverageAreaFactory)
    address = SubFactory(AddressFactory)
Esempio n. 7
0
class RoomFactory(BaseFactory):
    class Meta:
        model = Room

    number = Faker('numerify', text='## #')
    level = Faker('random_int', min=0, max=16)
    # This fix value makes more sense than a random one in most cases
    inhabitable = True

    building = SubFactory(BuildingFactory)
Esempio n. 8
0
class SellerFactory(PeeweeModelFactory):
    class Meta:
        model = operational.Seller

    PIB = FuzzyText(chars="0123456789", length=9)
    name = Faker('company')
    street = Faker('street_name')
    number = Faker('building_number')
    district = factory.LazyFunction(
        lambda: operational.District.select().order_by(fn.Rand()).get())
Esempio n. 9
0
class MarketFactory(DjangoModelFactory):
    class Meta:
        model = Market

    semester = SubFactory(SemesterFactory)
    start_date = Faker('past_datetime')
    end_date = Faker('future_datetime')

    slug = UniqueFaker('slug')
    title = Faker('bs')
    prompt = Faker('paragraph')
Esempio n. 10
0
class StudentRegistrationFactory(DjangoModelFactory):
    class Meta:
        model = StudentRegistration

    user = SubFactory(UserFactory)
    container = SubFactory(RegistrationContainerFactory)
    parent_email = Faker('ascii_safe_email')
    track = 'C'
    gender = 'H'
    graduation_year = 0
    school_name = Faker('city')
Esempio n. 11
0
class ProblemSuggestionFactory(DjangoModelFactory):
	class Meta:
		model = ProblemSuggestion

	user = SubFactory(UserFactory)
	unit = SubFactory(UnitFactory)
	weight = FuzzyChoice([2, 3, 5, 9])
	source = UniqueFaker('company')
	description = Faker('text')
	statement = Faker('sentence')
	solution = Faker('paragraph')
Esempio n. 12
0
class WebhookFactory(ResourceModelFactory):
    class Meta:
        model = Webhook

    resource = "webhook"

    method = "POST"
    url = Faker("uri")
    events = LazyFunction(
        lambda: [Faker("random_element", elements=Webhook.EVENTS).generate()])
    description = Faker("sentence", nb_words=5)
Esempio n. 13
0
class UserFactory(BaseFactory):
    class Meta:
        model = User

    login = Faker('user_name')
    name = Faker('name')
    registered_at = Faker('date_time')
    password = Faker('password')
    email = Faker('email')
    account = factory.SubFactory(AccountFactory, type="USER_ASSET")
    room = factory.SubFactory(RoomFactory)
Esempio n. 14
0
class PaymentFactory(BaseModelFactory):
    class Meta:
        model = Payment

    contract = SubFactory(ContractFactory)

    value = Faker('pyfloat',
                  positive=True,
                  right_digits=2,
                  max_value=100,
                  min_value=1)
    date = Faker('date_this_year')
Esempio n. 15
0
class UserFactory(BaseModelFactory):
    class Meta:
        model = User

    email = Faker('safe_email')
    username = Faker('user_name')
    first_name = Faker('first_name')
    last_name = Faker('last_name')
    cpf = Faker('text', max_nb_chars=14)

    is_staff = False
    is_superuser = False
Esempio n. 16
0
class AnalysisVersionFactory(DjangoModelFactory):
    title = Faker("ipv4")
    description = Faker("sentence")
    analysis = SubFactory("tests.factories.analysis.AnalysisFactory")
    input_specification = SubFactory(
        "tests.factories.input.input_specification.InputSpecificationFactory")
    output_specification = SubFactory(
        "tests.factories.output.output_specification.OutputSpecificationFactory"  # noqa: E501
    )

    class Meta:
        model = "django_analyses.AnalysisVersion"
Esempio n. 17
0
class VerificationModelFactory(ZoopObjectFactory):
    """
    Factory for instances with fake attributes.
    The Meta.model dictates which instance to be created.

    https://faker.readthedocs.io/en/latest/providers.html
    """

    class Meta:
        model = VerificationModel

    address_line1_check = Faker("pybool")
    postal_code_check = Faker("pybool")
Esempio n. 18
0
class SocialModelFactory(ZoopObjectFactory):
    """
    Factory for instances with fake attributes.
    The Meta.model dictates which instance to be created.

    https://faker.readthedocs.io/en/latest/providers.html
    """

    class Meta:
        model = SocialModel

    facebook = Faker("uri")
    twitter = Faker("uri")
Esempio n. 19
0
class AccountFactory(BaseFactory):
    class Meta:
        model = Account

    name = Faker('word')
    type = Faker('random_element', elements=(
        "ASSET",  # Aktivkonto
        "USER_ASSET",  # Aktivkonto for users
        "BANK_ASSET",  # Aktivkonto for bank accounts
        "LIABILITY",  # Passivkonto
        "EXPENSE",  # Aufwandskonto
        "REVENUE",  # Ertragskonto
    ))
Esempio n. 20
0
class BankAccountActivityFactory(BaseFactory):
    class Meta:
        model = BankAccountActivity

    bank_account = SubFactory(BankAccountFactory)
    amount = Faker('random_number', digits=5)
    reference = Sequence(lambda n: f"Reference {n}")
    other_account_number = Faker('random_number', digits=10)
    other_routing_number = Faker('random_number', digits=8)
    other_name = Faker('word')
    imported_at = LazyAttribute(
        lambda o: session.utcnow().date() - timedelta(days=4))
    posted_on = LazyAttribute(lambda o: o.imported_at + timedelta(days=1))
    valid_on = LazyAttribute(lambda o: o.posted_on + timedelta(minutes=30))
Esempio n. 21
0
class PaymentMethodFactory(ResourceModelFactory):
    """
    Factory for instances with fake attributes.
    The Meta.model dictates which instance to be created.

    https://faker.readthedocs.io/en/latest/providers.html
    """

    class Meta:
        model = PaymentMethod

    address = SubFactory(AddressFactory)
    customer = Faker("uuid4")
    description = Faker("sentence", nb_words=5)
Esempio n. 22
0
class AddressFactory(Factory):
    class Meta:
        model = Address

    owner = "algum id"
    city = "Natal"
    state = "RN"

    zip_code = "99999999"
    street = Faker("street_name")
    number = Faker("building_number")

    neighborhood = Faker("street_suffix")

    complement = Faker("text", max_nb_chars=100)
Esempio n. 23
0
class ArticleFactory(DjangoModelFactory):
    title = Sequence(lambda n: f'Статья {n}')
    text = Faker('text', max_nb_chars=1000)
    image = ImageField()

    class Meta:
        model = 'articles.Article'
Esempio n. 24
0
class TransactionFactory(BaseFactory):
    class Meta:
        model = Transaction

    description = Faker('word')
    author = SubFactory('tests.factories.user.UserFactory')

    posted_at = Faker('date')
    valid_on = Faker('date')

    confirmed = True

    splits = RelatedFactoryList(SplitFactory,
                                factory_related_name='transaction',
                                size=2,
                                amount=Iterator([5, -5]))
Esempio n. 25
0
class QuestCompleteFactory(DjangoModelFactory):
	class Meta:
		model = QuestComplete

	student = SubFactory(StudentFactory)
	title = Faker('job')
	spades = FuzzyChoice(list(range(1, 10)))
Esempio n. 26
0
class DistrictFactory(PeeweeModelFactory):
    class Meta:
        model = operational.District

    name = Faker('bothify', text="## ??")
    city = factory.LazyFunction(
        lambda: operational.City.select().order_by(fn.Rand()).get())
Esempio n. 27
0
class DefineMonthlyPlanFactory(Factory):
    class Meta:
        model = plan.cmd.DefineMonthlyPlan

    name = Faker('name', locale='pl_PL')
    monthlyFee = SubFactory(MoneyFactory)
    pauses = plan.cmd.MAX_NUMBER_OF_PAUSES
Esempio n. 28
0
class CardFactory(PaymentMethodFactory):
    class Meta:
        model = Card

    card_brand = Faker("company")
    expiration_month = Faker("pyint", min_value=1, max_value=12, step=1)
    expiration_year = Faker("pyint", min_value=2000, max_value=2030, step=1)
    fingerprint = Faker("uuid4")
    first4_digits = Faker("pyint", min_value=1000, max_value=9999, step=1)
    holder_name = Faker("name")
    is_active = Faker("pybool")
    is_valid = Faker("pybool")
    is_verified = Faker("pybool")
    last4_digits = Faker("pyint", min_value=1000, max_value=9999, step=1)
    resource = "card"
    verification_checklist = SubFactory(CardVerificationChecklistFactory)
Esempio n. 29
0
class CompanyFactory(DjangoModelFactory):
    """Factory to generate companies."""

    class Meta:
        model = Company

    name = Faker("company")
    theme = RelatedFactory(ColourThemeFactory, "company")
Esempio n. 30
0
class ResourceModelFactory(ZoopObjectFactory):
    """
    Factory for instances with fake attributes.
    The Meta.model dictates which instance to be created.

    https://faker.readthedocs.io/en/latest/providers.html
    """

    class Meta:
        model = ResourceModel

    created_at = Faker("date_of_birth")
    id = Faker("uuid4")
    metadata = {}
    resource = "resource"
    updated_at = Faker("date_this_month")
    uri = Faker("uri")