factory-boy Questions

1

Solved

I want to use Factory Boy and its support for Faker to generate strings from more than one provider. e.g. combining prefix and name: # models.py from django.db import models class Person(models.M...
Antlion asked 7/9, 2017 at 15:19

1

Solved

I'm using Factory Boy for testing a Django project and I've run into an issue while testing a model for which I've overridden the save method. The model: class Profile(models.Model): active = m...
Enolaenormity asked 16/8, 2017 at 12:47

1

Solved

My problem is the one bellow. If I try to run the test, it says there is no database permission and that I have to add that fixture. The problem is that I have added that fixture to any possible me...
Docile asked 12/7, 2017 at 11:26

1

Solved

I'm building a factory with factory_boy that generates a django model. I would like to see what arguments the user inputs inline. My factory itself looks like this class SomeFactory(factory.django...
Parturition asked 14/6, 2017 at 22:8

4

Solved

factory_boy defaults to 1 for sequences. How can I pass in a number to use as a different starting number instead? I can subclass the _setup_next_sequence() method, but how can I give it a variable...
Thill asked 14/3, 2013 at 5:59

2

I am trying to create an instance of the model in which one of the field is JSONField. When creating the instance of model via factoryboy, I want to save the field as JSONField in the test database...
Yingyingkow asked 2/6, 2015 at 13:40

1

Solved

I'm having problems setting up a many to many relationship with a set of django models in factory boy, using a through relationship. I have a bunch of recipes and ingredients. There is a many-to-ma...
Proffer asked 11/10, 2016 at 10:31

2

Solved

I'm trying to make factories for these models with factory_boy: class Course(models.Model): group = models.OneToOneField(Group) title = models.CharField(max_length=1024) class CourseInfo(model...
Faulty asked 16/3, 2016 at 15:13

3

Does anyone know how to create the factory in factoryboy based on this models.py class Halte(models.Model): koppel_halte1 = models.ForeignKey('self', related_name='koppel_halteA', verbose_name...
Ankle asked 5/2, 2016 at 15:32

2

I am fairly new to Django. I am trying to set the groups field for User using factory_boy. The default User class has a field _groups. I tried setting that, but that is not helping. class GroupFac...
Muskeg asked 6/2, 2015 at 14:11

1

Solved

By using Model Mommy, you don't have to set every Model field you use, Model Mommy will automatically set them for you. but in Factory Boy, if you want to use some field in the test, you have to e...
Automotive asked 22/2, 2016 at 3:37

1

I would like to pass @pytest.mark.parametrize not particular values but fixtures. Like so. Given a conftest with: @pytest.fixture def name1(): return 'foo' @pytest.fixture def name2(): return ...
Breeching asked 9/11, 2015 at 14:27

2

Solved

I am using factory.LazyAttribute within a SubFactory call to pass in an object, created in the factory_parent. This works fine. But if I pass the object created to a RelatedFactory, LazyAttribute ...
Present asked 12/10, 2015 at 19:44

1

Solved

I'm using Flask and SQLAlchemy (via the Flask-SQLAlchemy extension) together with Factory_Boy. My GearItem model has a foreign key to GearCategory. Factory_Boy handles this through the SubFactory...
Bilbao asked 7/8, 2015 at 7:59

0

When I named my RelatedFactory variables pv_something, the factories wouldn't be run until after the post_generation method. When I renamed the variables to param_val_something they would be run be...
Caprifoliaceous asked 30/10, 2015 at 20:49

2

Solved

I have a function with a number of parameters, then a specialized instantiation of that function, with some settings for each of the function's parameters. So I have a structure like the following:...
Doublehung asked 7/10, 2015 at 14:37

3

Solved

What is the correct way to use factory boy with Flask-SQLAlchemy and Foreign Key constraints? Consider the following Flask SQLAlchemy Model setup: # coding=utf-8 from flask import Flask from fl...
Junna asked 15/7, 2015 at 19:38

2

Solved

I want to create a mix of string and digits like this: "XL1A" or "PP25" for one field in my database.How can I do that? I'm using only uppercase letter for now. class CardFactory(DjangoModelFacto...
Vacuity asked 13/3, 2015 at 8:6

2

Solved

class MyClassTest(TestCase): def setUp(self): Someclass.objects.create() def test_first_test(self): # Here, Someclass.objects.all()[0].pk -> returns 1 def test_second_test(self): # Here,...
Assignation asked 31/10, 2014 at 0:19

2

Solved

I just run into a problem with my testsuite. I am using a setup with nosetests, SQLAlchemy, Flask and Factory-Boy I have the following code: def _create_fixtures(self): self.user = UserFactory()...
Mainsail asked 5/4, 2014 at 22:52

1

Solved

Subj. Right now (Factory Boy ver. 2.4.1.) with this code: class ImageFactory(factory.django.DjangoModelFactory): class Meta: model = Image image = factory.django.ImageField(width=1024, height...
Hara asked 12/9, 2014 at 10:40

1

My unit testings are failing when i want to test Login functionality. When I test in my browser is's OK. I'm using: django==1.6.5 factory-boy==2.4.1 WebTest==2.0.15 django-webtest==1.7.7 nose==1....
Pentachlorophenol asked 15/7, 2014 at 0:35

3

Solved

I have just started using factory boy with Django. It has a setting FACTORY_DJANGO_GET_OR_CREATE that means it won't create a new object if one already exists. But when I ask for an existing object...
Misti asked 20/6, 2013 at 6:28

2

I'm trying to test a many-to-many relationship between two Django models using factory_boy. The factory_boy documentation doesn't appear to discuss this and I'm having trouble figuring out what I'm...
Bittner asked 24/1, 2013 at 22:26

1

Solved

I don't see why factory_boy is preferred over creating ORM/model instances directly in Django tests. And the factory_boy website does little to explain the benefits of using it. It makes sense as ...
Gobetween asked 28/4, 2014 at 19:41

© 2022 - 2024 — McMap. All rights reserved.