factory-boy Questions
4
Solved
I'm using factory_boy to replace fixtures in a Django app. I have a Product model that should have many Offers and Merchants.
#models.py
class Product(models.Model):
name = models.CharField()
cl...
Octahedron asked 4/2, 2014 at 22:27
2
Solved
I am using factory_boy package and DjangoModelFactory to generate a factory model with muted signals
@factory.django.mute_signals(signals.post_save)
class SomeModelTargetFactory(DjangoModelFactory)...
Finality asked 26/7, 2017 at 8:6
7
I'm a relative Django beginner and just started doing some testing for my projects. What I want to do is build a functional test with selenium that logs into the Django Admin site.
I first follow...
Smashup asked 25/3, 2013 at 13:34
6
Solved
I'm using factory_boy to create test fixtures. I've got two simple factories, backed by SQLAlchemy models (simplified below).
I'd like to be able to call AddressFactory.create() multiple times, an...
Wheelwork asked 2/10, 2013 at 21:26
2
I'm trying to use factory boy with async SQLAlchemy, concrete SQLModel ORM and having issue while calling factory boy create method it creates only instance od object but never stored in DB. My fac...
Commit asked 16/2, 2023 at 7:18
3
Solved
I am using Factory Boy to create test factories for my django app. The model I am having an issue with is a very basic Account model which has a OneToOne relation to the django User auth model (usi...
Adkinson asked 9/7, 2013 at 15:2
5
Solved
How can I set the default locale in Python's factory_boy for all of my Factories?
In docs says that one should set it with factory.Faker.override_default_locale but that does nothing to my fakers....
Kristalkristan asked 19/8, 2017 at 16:40
2
I started using the factory_boy package so I've set up some factories and wanted to test that the objects created don't raise any validation errors.
Here's the mixin I'm using that basically takes...
Blowzed asked 13/9, 2019 at 12:18
4
Solved
I need to create some fake data using factory boy. I have the following model:
class Fabric(models.Model):
title = models.CharField(max_length=200, blank=True)
description = models.CharField(max...
Cahn asked 30/4, 2019 at 1:40
2
I am attempting to add some custom faker provider to use with factory_boy and pytest.
I put the provider in
faker_providers/foo.py/Provider.
In my factories.py file, I have to import foo.py and t...
Aggi asked 26/10, 2018 at 18:20
5
Solved
Factory_boy uses fake-factory (Faker) to generate random values, I would like to generate some random values in my Django tests using Faker directly.
Factory_boy docs suggests using factory.Faker a...
Attorn asked 31/7, 2016 at 19:7
2
I am using pytest as framework for testing my application and I want to use pytest factoryboy as well. Thusfar, my conftest.py looks pretty much like the example:
import factory
from sqlalchemy im...
Chausses asked 7/11, 2017 at 18:46
2
Solved
I'm using FactoryBoy and Faker to generate some models for unit tests.
Generating data for fields is easy enough, but how to I generate a string that incorporates a value produced from a Faker prov...
Carmina asked 29/7, 2021 at 7:7
2
Solved
Context:
I have a model with two dates, I want to use factory.Faker for both of them but the second date should always be greater that the first one.
I tried this:
Model excerpt:
class Event(mod...
Sleep asked 12/7, 2017 at 22:34
1
Solved
I have a Model Sector which has a id field (pk) which is UUID4 type.
I am trying to populate that table(Sector Model) using faker and factory_boy.
But,
DETAIL: Key (id)=(46f0cf58-7e63-4d0b-9dff-e15...
Coverlet asked 12/2, 2022 at 14:27
2
I keep running into issues with my factories when two or more models have a common foreign key, and each one creates their own object when they should have the same.
To illustrate the problem, her...
Coruscation asked 6/9, 2016 at 9:21
5
Solved
When a field in a Django model has the option choices, see Django choices field option, it utilises an iterable containing iterables of 2 items to define which values are allowed. For example:
Mod...
Photoflash asked 15/4, 2016 at 8:4
5
Solved
I have django 1.11 app and I want to write unit test for my solution.
I want to test registration date feature.
model.py:
class User(models.Model):
first_name = models.CharField(max_length=30)
...
Nuno asked 17/4, 2018 at 9:50
2
Solved
I'm trying to use Factoryboy to create a list in an object of the length specified when created.
I can create the list, but every attempt to create a list with the length specified causes issues ...
Liveryman asked 11/11, 2019 at 13:18
4
I need to create ten sample users (User) and each of them must have fifty documents (Doc). How to do this in tests.py using factoryboy?
#factories.py
from app_name.models import *
import factory
...
Pepita asked 29/1, 2013 at 18:7
2
Solved
How to define a field that depends on other field using factory-boy?
For instance, I'd like to define an email that depends on the first name and last name of an User.
I tried using the post_gen...
Puttyroot asked 27/11, 2015 at 23:2
2
Solved
I am using factory_boy to build some fixtures in Django.
I want to use factory.LazyAttribute to build one attribute based on the condition of another attribute.
class MyFactory(factory.django.Djang...
Vanesavanessa asked 6/7, 2020 at 12:26
4
Solved
I'm working on writing tests for a new GeoDjango project I've started. Normally I used Factory Boy and Faker to create model instances for testing. However it's not clear to me how you can mock Geo...
Sabinesabino asked 28/9, 2015 at 17:47
2
I am using factory boy with SQLAlchemy.
I am trying to create Fact objects, and I want factory boy to generate PatientDim objects that are foreign keys to Fact. But Subfactory doesn't pass the key...
Dunnock asked 16/11, 2016 at 4:45
2
Solved
I am trying to use factory.faker to randomly choose from a list of four companies and use them as a traffic source for a list of generated names. I am using the below code:
from django.db import m...
Underbrush asked 4/7, 2020 at 0:39
1 Next >
© 2022 - 2024 — McMap. All rights reserved.