aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cyclic/bar.py2
-rw-r--r--tests/cyclic/foo.py2
-rw-r--r--tests/test_alchemy.py4
-rw-r--r--tests/test_base.py56
-rw-r--r--tests/test_containers.py2
-rw-r--r--tests/test_deprecation.py2
-rw-r--r--tests/test_django.py40
-rw-r--r--tests/test_mongoengine.py4
-rw-r--r--tests/test_using.py246
9 files changed, 179 insertions, 179 deletions
diff --git a/tests/cyclic/bar.py b/tests/cyclic/bar.py
index 8674c4d..a5e6bf1 100644
--- a/tests/cyclic/bar.py
+++ b/tests/cyclic/bar.py
@@ -31,7 +31,7 @@ class Bar(object):
class BarFactory(factory.Factory):
class Meta:
- target = Bar
+ model = Bar
y = 13
foo = factory.SubFactory('cyclic.foo.FooFactory')
diff --git a/tests/cyclic/foo.py b/tests/cyclic/foo.py
index 5310b1e..18de362 100644
--- a/tests/cyclic/foo.py
+++ b/tests/cyclic/foo.py
@@ -33,7 +33,7 @@ class Foo(object):
class FooFactory(factory.Factory):
class Meta:
- target = Foo
+ model = Foo
x = 42
bar = factory.SubFactory(bar_mod.BarFactory)
diff --git a/tests/test_alchemy.py b/tests/test_alchemy.py
index 4526ad1..b9222eb 100644
--- a/tests/test_alchemy.py
+++ b/tests/test_alchemy.py
@@ -48,7 +48,7 @@ else:
class StandardFactory(SQLAlchemyModelFactory):
class Meta:
- target = models.StandardModel
+ model = models.StandardModel
sqlalchemy_session = models.session
id = factory.Sequence(lambda n: n)
@@ -57,7 +57,7 @@ class StandardFactory(SQLAlchemyModelFactory):
class NonIntegerPkFactory(SQLAlchemyModelFactory):
class Meta:
- target = models.NonIntegerPk
+ model = models.NonIntegerPk
sqlalchemy_session = models.session
id = factory.Sequence(lambda n: 'foo%d' % n)
diff --git a/tests/test_base.py b/tests/test_base.py
index c44ebd5..d93bf29 100644
--- a/tests/test_base.py
+++ b/tests/test_base.py
@@ -53,8 +53,8 @@ class FakeModelFactory(base.Factory):
abstract = True
@classmethod
- def _create(cls, target_class, *args, **kwargs):
- return target_class.create(**kwargs)
+ def _create(cls, model_class, *args, **kwargs):
+ return model_class.create(**kwargs)
class TestModel(FakeDjangoModel):
@@ -68,13 +68,13 @@ class SafetyTestCase(unittest.TestCase):
class AbstractFactoryTestCase(unittest.TestCase):
def test_factory_for_optional(self):
- """Ensure that target= is optional for abstract=True."""
+ """Ensure that model= is optional for abstract=True."""
class TestObjectFactory(base.Factory):
class Meta:
abstract = True
self.assertTrue(TestObjectFactory._meta.abstract)
- self.assertIsNone(TestObjectFactory._meta.target)
+ self.assertIsNone(TestObjectFactory._meta.model)
def test_factory_for_and_abstract_factory_optional(self):
"""Ensure that Meta.abstract is optional."""
@@ -82,7 +82,7 @@ class AbstractFactoryTestCase(unittest.TestCase):
pass
self.assertTrue(TestObjectFactory._meta.abstract)
- self.assertIsNone(TestObjectFactory._meta.target)
+ self.assertIsNone(TestObjectFactory._meta.model)
def test_abstract_factory_cannot_be_called(self):
class TestObjectFactory(base.Factory):
@@ -97,18 +97,18 @@ class AbstractFactoryTestCase(unittest.TestCase):
class TestObjectFactory(base.Factory):
class Meta:
abstract = True
- target = TestObject
+ model = TestObject
class TestObjectChildFactory(TestObjectFactory):
pass
self.assertFalse(TestObjectChildFactory._meta.abstract)
- def test_abstract_or_target_is_required(self):
+ def test_abstract_or_model_is_required(self):
class TestObjectFactory(base.Factory):
class Meta:
abstract = False
- target = None
+ model = None
self.assertRaises(base.FactoryError, TestObjectFactory.build)
self.assertRaises(base.FactoryError, TestObjectFactory.create)
@@ -121,7 +121,7 @@ class OptionsTests(unittest.TestCase):
# Declarative attributes
self.assertTrue(AbstractFactory._meta.abstract)
- self.assertIsNone(AbstractFactory._meta.target)
+ self.assertIsNone(AbstractFactory._meta.model)
self.assertEqual((), AbstractFactory._meta.arg_parameters)
self.assertEqual((), AbstractFactory._meta.hidden_args)
self.assertEqual(base.CREATE_STRATEGY, AbstractFactory._meta.strategy)
@@ -206,7 +206,7 @@ class DeclarationParsingTests(unittest.TestCase):
def test_classmethod(self):
class TestObjectFactory(base.Factory):
class Meta:
- target = TestObject
+ model = TestObject
@classmethod
def some_classmethod(cls):
@@ -222,16 +222,16 @@ class FactoryTestCase(unittest.TestCase):
"""Calling a FooFactory doesn't yield a FooFactory instance."""
class TestObjectFactory(base.Factory):
class Meta:
- target = TestObject
+ model = TestObject
- self.assertEqual(TestObject, TestObjectFactory._meta.target)
+ self.assertEqual(TestObject, TestObjectFactory._meta.model)
obj = TestObjectFactory.build()
self.assertFalse(hasattr(obj, '_meta'))
def test_display(self):
class TestObjectFactory(base.Factory):
class Meta:
- target = FakeDjangoModel
+ model = FakeDjangoModel
self.assertIn('TestObjectFactory', str(TestObjectFactory))
self.assertIn('FakeDjangoModel', str(TestObjectFactory))
@@ -239,7 +239,7 @@ class FactoryTestCase(unittest.TestCase):
def test_lazy_attribute_non_existent_param(self):
class TestObjectFactory(base.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = declarations.LazyAttribute(lambda a: a.does_not_exist )
@@ -249,13 +249,13 @@ class FactoryTestCase(unittest.TestCase):
"""Tests that sequence IDs are shared between parent and son."""
class TestObjectFactory(base.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = declarations.Sequence(lambda a: a)
class TestSubFactory(TestObjectFactory):
class Meta:
- target = TestObject
+ model = TestObject
pass
@@ -273,7 +273,7 @@ class FactorySequenceTestCase(unittest.TestCase):
class TestObjectFactory(base.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = declarations.Sequence(lambda n: n)
self.TestObjectFactory = TestObjectFactory
@@ -358,7 +358,7 @@ class FactoryDefaultStrategyTestCase(unittest.TestCase):
class TestModelFactory(base.Factory):
class Meta:
- target = TestModel
+ model = TestModel
one = 'one'
@@ -371,7 +371,7 @@ class FactoryDefaultStrategyTestCase(unittest.TestCase):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 'one'
@@ -384,7 +384,7 @@ class FactoryDefaultStrategyTestCase(unittest.TestCase):
class TestModelFactory(base.Factory):
class Meta:
- target = TestModel
+ model = TestModel
one = 'one'
@@ -397,7 +397,7 @@ class FactoryDefaultStrategyTestCase(unittest.TestCase):
class TestModelFactory(base.Factory):
class Meta:
- target = TestModel
+ model = TestModel
one = 'one'
@@ -406,7 +406,7 @@ class FactoryDefaultStrategyTestCase(unittest.TestCase):
def test_stub_with_non_stub_strategy(self):
class TestModelFactory(base.StubFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 'one'
@@ -421,7 +421,7 @@ class FactoryDefaultStrategyTestCase(unittest.TestCase):
@base.use_strategy(base.CREATE_STRATEGY)
class TestModelFactory(base.StubFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 'one'
@@ -432,7 +432,7 @@ class FactoryCreationTestCase(unittest.TestCase):
def test_factory_for(self):
class TestFactory(base.Factory):
class Meta:
- target = TestObject
+ model = TestObject
self.assertTrue(isinstance(TestFactory.build(), TestObject))
@@ -445,7 +445,7 @@ class FactoryCreationTestCase(unittest.TestCase):
def test_inheritance_with_stub(self):
class TestObjectFactory(base.StubFactory):
class Meta:
- target = TestObject
+ model = TestObject
pass
@@ -457,7 +457,7 @@ class FactoryCreationTestCase(unittest.TestCase):
def test_custom_creation(self):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
@classmethod
def _prepare(cls, create, **kwargs):
@@ -488,7 +488,7 @@ class PostGenerationParsingTestCase(unittest.TestCase):
def test_extraction(self):
class TestObjectFactory(base.Factory):
class Meta:
- target = TestObject
+ model = TestObject
foo = declarations.PostGenerationDeclaration()
@@ -497,7 +497,7 @@ class PostGenerationParsingTestCase(unittest.TestCase):
def test_classlevel_extraction(self):
class TestObjectFactory(base.Factory):
class Meta:
- target = TestObject
+ model = TestObject
foo = declarations.PostGenerationDeclaration()
foo__bar = 42
diff --git a/tests/test_containers.py b/tests/test_containers.py
index 8a9e990..bd7019e 100644
--- a/tests/test_containers.py
+++ b/tests/test_containers.py
@@ -94,7 +94,7 @@ class LazyStubTestCase(unittest.TestCase):
class RandomObj(object):
pass
- stub = containers.LazyStub({'one': 1, 'two': 2}, target_class=RandomObj)
+ stub = containers.LazyStub({'one': 1, 'two': 2}, model_class=RandomObj)
self.assertIn('RandomObj', repr(stub))
self.assertIn('RandomObj', str(stub))
self.assertIn('one', str(stub))
diff --git a/tests/test_deprecation.py b/tests/test_deprecation.py
index bccc351..bad6104 100644
--- a/tests/test_deprecation.py
+++ b/tests/test_deprecation.py
@@ -46,4 +46,4 @@ class DeprecationTests(unittest.TestCase):
# This is to ensure error messages are readable by end users.
self.assertEqual(__file__, warning.filename)
self.assertIn('FACTORY_FOR', str(warning.message))
- self.assertIn('target', str(warning.message))
+ self.assertIn('model', str(warning.message))
diff --git a/tests/test_django.py b/tests/test_django.py
index 2bc5fe2..84b0933 100644
--- a/tests/test_django.py
+++ b/tests/test_django.py
@@ -100,14 +100,14 @@ def tearDownModule():
class StandardFactory(factory.django.DjangoModelFactory):
class Meta:
- target = models.StandardModel
+ model = models.StandardModel
foo = factory.Sequence(lambda n: "foo%d" % n)
class StandardFactoryWithPKField(factory.django.DjangoModelFactory):
class Meta:
- target = models.StandardModel
+ model = models.StandardModel
django_get_or_create = ('pk',)
foo = factory.Sequence(lambda n: "foo%d" % n)
@@ -116,7 +116,7 @@ class StandardFactoryWithPKField(factory.django.DjangoModelFactory):
class NonIntegerPkFactory(factory.django.DjangoModelFactory):
class Meta:
- target = models.NonIntegerPk
+ model = models.NonIntegerPk
foo = factory.Sequence(lambda n: "foo%d" % n)
bar = ''
@@ -124,7 +124,7 @@ class NonIntegerPkFactory(factory.django.DjangoModelFactory):
class AbstractBaseFactory(factory.django.DjangoModelFactory):
class Meta:
- target = models.AbstractBase
+ model = models.AbstractBase
abstract = True
foo = factory.Sequence(lambda n: "foo%d" % n)
@@ -132,22 +132,22 @@ class AbstractBaseFactory(factory.django.DjangoModelFactory):
class ConcreteSonFactory(AbstractBaseFactory):
class Meta:
- target = models.ConcreteSon
+ model = models.ConcreteSon
class AbstractSonFactory(AbstractBaseFactory):
class Meta:
- target = models.AbstractSon
+ model = models.AbstractSon
class ConcreteGrandSonFactory(AbstractBaseFactory):
class Meta:
- target = models.ConcreteGrandSon
+ model = models.ConcreteGrandSon
class WithFileFactory(factory.django.DjangoModelFactory):
class Meta:
- target = models.WithFile
+ model = models.WithFile
if django is not None:
afile = factory.django.FileField()
@@ -155,7 +155,7 @@ class WithFileFactory(factory.django.DjangoModelFactory):
class WithImageFactory(factory.django.DjangoModelFactory):
class Meta:
- target = models.WithImage
+ model = models.WithImage
if django is not None:
animage = factory.django.ImageField()
@@ -163,7 +163,7 @@ class WithImageFactory(factory.django.DjangoModelFactory):
class WithSignalsFactory(factory.django.DjangoModelFactory):
class Meta:
- target = models.WithSignals
+ model = models.WithSignals
@unittest.skipIf(django is None, "Django not installed.")
@@ -231,19 +231,19 @@ class DjangoPkForceTestCase(django_test.TestCase):
@unittest.skipIf(django is None, "Django not installed.")
class DjangoModelLoadingTestCase(django_test.TestCase):
"""Tests class Meta:
- target = 'app.Model' pattern."""
+ model = 'app.Model' pattern."""
def test_loading(self):
class ExampleFactory(factory.DjangoModelFactory):
class Meta:
- target = 'djapp.StandardModel'
+ model = 'djapp.StandardModel'
- self.assertEqual(models.StandardModel, ExampleFactory._get_target_class())
+ self.assertEqual(models.StandardModel, ExampleFactory._get_model_class())
def test_building(self):
class ExampleFactory(factory.DjangoModelFactory):
class Meta:
- target = 'djapp.StandardModel'
+ model = 'djapp.StandardModel'
e = ExampleFactory.build()
self.assertEqual(models.StandardModel, e.__class__)
@@ -255,7 +255,7 @@ class DjangoModelLoadingTestCase(django_test.TestCase):
"""
class ExampleFactory(factory.DjangoModelFactory):
class Meta:
- target = 'djapp.StandardModel'
+ model = 'djapp.StandardModel'
class Example2Factory(ExampleFactory):
pass
@@ -270,15 +270,15 @@ class DjangoModelLoadingTestCase(django_test.TestCase):
"""
class ExampleFactory(factory.DjangoModelFactory):
class Meta:
- target = 'djapp.StandardModel'
+ model = 'djapp.StandardModel'
foo = factory.Sequence(lambda n: n)
class Example2Factory(ExampleFactory):
class Meta:
- target = 'djapp.StandardSon'
+ model = 'djapp.StandardSon'
- self.assertEqual(models.StandardSon, Example2Factory._get_target_class())
+ self.assertEqual(models.StandardSon, Example2Factory._get_model_class())
e1 = ExampleFactory.build()
e2 = Example2Factory.build()
@@ -580,7 +580,7 @@ class PreventSignalsTestCase(unittest.TestCase):
@factory.django.mute_signals(signals.pre_save, signals.post_save)
class WithSignalsDecoratedFactory(factory.django.DjangoModelFactory):
class Meta:
- target = models.WithSignals
+ model = models.WithSignals
WithSignalsDecoratedFactory()
@@ -594,7 +594,7 @@ class PreventSignalsTestCase(unittest.TestCase):
@factory.django.mute_signals(signals.pre_save, signals.post_save)
class WithSignalsDecoratedFactory(factory.django.DjangoModelFactory):
class Meta:
- target = models.WithSignals
+ model = models.WithSignals
WithSignalsDecoratedFactory.build()
diff --git a/tests/test_mongoengine.py b/tests/test_mongoengine.py
index 39594c0..988c179 100644
--- a/tests/test_mongoengine.py
+++ b/tests/test_mongoengine.py
@@ -43,13 +43,13 @@ if mongoengine:
class AddressFactory(MongoEngineFactory):
class Meta:
- target = Address
+ model = Address
street = factory.Sequence(lambda n: 'street%d' % n)
class PersonFactory(MongoEngineFactory):
class Meta:
- target = Person
+ model = Person
name = factory.Sequence(lambda n: 'name%d' % n)
address = factory.SubFactory(AddressFactory)
diff --git a/tests/test_using.py b/tests/test_using.py
index 6e7ed64..5486d33 100644
--- a/tests/test_using.py
+++ b/tests/test_using.py
@@ -82,8 +82,8 @@ class FakeModelFactory(factory.Factory):
abstract = True
@classmethod
- def _create(cls, target_class, *args, **kwargs):
- return target_class.create(**kwargs)
+ def _create(cls, model_class, *args, **kwargs):
+ return model_class.create(**kwargs)
class TestModel(FakeModel):
@@ -294,18 +294,18 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_attribute(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = 'one'
test_object = TestObjectFactory.build()
self.assertEqual(test_object.one, 'one')
- def test_inheriting_target_class(self):
+ def test_inheriting_model_class(self):
@factory.use_strategy(factory.BUILD_STRATEGY)
class TestObjectFactory(factory.Factory, TestObject):
class Meta:
- target = TestObject
+ model = TestObject
one = 'one'
@@ -321,7 +321,7 @@ class UsingFactoryTestCase(unittest.TestCase):
class InheritedFactory(SomeAbstractFactory):
class Meta:
- target = TestObject
+ model = TestObject
test_object = InheritedFactory.build()
self.assertEqual(test_object.one, 'one')
@@ -329,7 +329,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_sequence(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.Sequence(lambda n: 'one%d' % n)
two = factory.Sequence(lambda n: 'two%d' % n)
@@ -345,7 +345,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_sequence_custom_begin(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
@classmethod
def _setup_next_sequence(cls):
@@ -365,7 +365,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_sequence_override(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.Sequence(lambda n: 'one%d' % n)
@@ -382,13 +382,13 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_custom_create(self):
class TestModelFactory(factory.Factory):
class Meta:
- target = TestModel
+ model = TestModel
two = 2
@classmethod
- def _create(cls, target_class, *args, **kwargs):
- obj = target_class.create(**kwargs)
+ def _create(cls, model_class, *args, **kwargs):
+ obj = model_class.create(**kwargs)
obj.properly_created = True
return obj
@@ -406,7 +406,7 @@ class UsingFactoryTestCase(unittest.TestCase):
class NonDjangoFactory(factory.Factory):
class Meta:
- target = NonDjango
+ model = NonDjango
x = 3
@@ -417,7 +417,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_sequence_batch(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.Sequence(lambda n: 'one%d' % n)
two = factory.Sequence(lambda n: 'two%d' % n)
@@ -433,7 +433,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_lazy_attribute(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.LazyAttribute(lambda a: 'abc' )
two = factory.LazyAttribute(lambda a: a.one + ' xyz')
@@ -445,7 +445,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_lazy_attribute_sequence(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.LazyAttributeSequence(lambda a, n: 'abc%d' % n)
two = factory.LazyAttributeSequence(lambda a, n: a.one + ' xyz%d' % n)
@@ -461,7 +461,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_lazy_attribute_decorator(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
@factory.lazy_attribute
def one(a):
@@ -476,7 +476,7 @@ class UsingFactoryTestCase(unittest.TestCase):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = 'xx'
two = factory.SelfAttribute('one')
@@ -496,13 +496,13 @@ class UsingFactoryTestCase(unittest.TestCase):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 3
three = factory.SelfAttribute('..bar')
class TestModel2Factory(FakeModelFactory):
class Meta:
- target = TestModel2
+ model = TestModel2
bar = 4
two = factory.SubFactory(TestModelFactory, one=1)
@@ -512,7 +512,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_sequence_decorator(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
@factory.sequence
def one(n):
@@ -524,7 +524,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_lazy_attribute_sequence_decorator(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
@factory.lazy_attribute_sequence
def one(a, n):
@@ -540,7 +540,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_build_with_parameters(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.Sequence(lambda n: 'one%d' % n)
two = factory.Sequence(lambda n: 'two%d' % n)
@@ -557,7 +557,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_create(self):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 'one'
@@ -568,7 +568,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_create_batch(self):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 'one'
@@ -585,7 +585,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_generate_build(self):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 'one'
@@ -596,7 +596,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_generate_create(self):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 'one'
@@ -607,7 +607,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_generate_stub(self):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 'one'
@@ -618,7 +618,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_generate_batch_build(self):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 'one'
@@ -635,7 +635,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_generate_batch_create(self):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 'one'
@@ -652,7 +652,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_generate_batch_stub(self):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 'one'
@@ -669,7 +669,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_simple_generate_build(self):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 'one'
@@ -680,7 +680,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_simple_generate_create(self):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 'one'
@@ -691,7 +691,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_simple_generate_batch_build(self):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 'one'
@@ -708,7 +708,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_simple_generate_batch_create(self):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 'one'
@@ -725,7 +725,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_stub_batch(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = 'one'
two = factory.LazyAttribute(lambda a: a.one + ' two')
@@ -745,14 +745,14 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_inheritance(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = 'one'
two = factory.LazyAttribute(lambda a: a.one + ' two')
class TestObjectFactory2(TestObjectFactory):
class Meta:
- target = TestObject
+ model = TestObject
three = 'three'
four = factory.LazyAttribute(lambda a: a.three + ' four')
@@ -770,13 +770,13 @@ class UsingFactoryTestCase(unittest.TestCase):
"""Sequence counters should be kept within an inheritance chain."""
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.Sequence(lambda n: n)
class TestObjectFactory2(TestObjectFactory):
class Meta:
- target = TestObject
+ model = TestObject
to1a = TestObjectFactory()
self.assertEqual(0, to1a.one)
@@ -794,13 +794,13 @@ class UsingFactoryTestCase(unittest.TestCase):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.Sequence(lambda n: n)
class TestObjectFactory2(TestObjectFactory):
class Meta:
- target = TestObject2
+ model = TestObject2
to1a = TestObjectFactory()
self.assertEqual(0, to1a.one)
@@ -826,13 +826,13 @@ class UsingFactoryTestCase(unittest.TestCase):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.Sequence(lambda n: n)
class TestObjectFactory2(TestObjectFactory):
class Meta:
- target = TestObject2
+ model = TestObject2
to1a = TestObjectFactory()
self.assertEqual(0, to1a.one)
@@ -847,7 +847,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_inheritance_with_inherited_class(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = 'one'
two = factory.LazyAttribute(lambda a: a.one + ' two')
@@ -865,13 +865,13 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_dual_inheritance(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = 'one'
class TestOtherFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
two = 'two'
four = 'four'
@@ -887,7 +887,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_class_method_accessible(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
@classmethod
def alt_create(cls, **kwargs):
@@ -898,7 +898,7 @@ class UsingFactoryTestCase(unittest.TestCase):
def test_static_method_accessible(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
@staticmethod
def alt_create(**kwargs):
@@ -914,7 +914,7 @@ class UsingFactoryTestCase(unittest.TestCase):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
arg_parameters = ('x', 'y')
x = 1
@@ -934,7 +934,7 @@ class UsingFactoryTestCase(unittest.TestCase):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
hidden_args = ('x', 'z')
x = 1
@@ -954,7 +954,7 @@ class UsingFactoryTestCase(unittest.TestCase):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
hidden_args = ('x', 'z')
arg_parameters = ('y',)
@@ -978,7 +978,7 @@ class NonKwargParametersTestCase(unittest.TestCase):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
arg_parameters = ('one', 'two',)
one = 1
@@ -1004,7 +1004,7 @@ class NonKwargParametersTestCase(unittest.TestCase):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
arg_parameters = ('one', 'two')
one = 1
@@ -1012,8 +1012,8 @@ class NonKwargParametersTestCase(unittest.TestCase):
three = 3
@classmethod
- def _create(cls, target_class, *args, **kwargs):
- return target_class.create(*args, **kwargs)
+ def _create(cls, model_class, *args, **kwargs):
+ return model_class.create(*args, **kwargs)
obj = TestObjectFactory.create()
self.assertEqual((1, 2), obj.args)
@@ -1031,7 +1031,7 @@ class KwargAdjustTestCase(unittest.TestCase):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
@classmethod
def _adjust_kwargs(cls, **kwargs):
@@ -1050,12 +1050,12 @@ class SubFactoryTestCase(unittest.TestCase):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 3
class TestModel2Factory(FakeModelFactory):
class Meta:
- target = TestModel2
+ model = TestModel2
two = factory.SubFactory(TestModelFactory, one=1)
test_model = TestModel2Factory(two__one=4)
@@ -1069,11 +1069,11 @@ class SubFactoryTestCase(unittest.TestCase):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
class TestModel2Factory(FakeModelFactory):
class Meta:
- target = TestModel2
+ model = TestModel2
two = factory.SubFactory(TestModelFactory,
one=factory.Sequence(lambda n: 'x%dx' % n),
two=factory.LazyAttribute(lambda o: '%s%s' % (o.one, o.one)),
@@ -1091,13 +1091,13 @@ class SubFactoryTestCase(unittest.TestCase):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.Sequence(lambda n: int(n))
class WrappingTestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
wrapped = factory.SubFactory(TestObjectFactory)
@@ -1114,7 +1114,7 @@ class SubFactoryTestCase(unittest.TestCase):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
class OtherTestObject(object):
@@ -1124,7 +1124,7 @@ class SubFactoryTestCase(unittest.TestCase):
class WrappingTestObjectFactory(factory.Factory):
class Meta:
- target = OtherTestObject
+ model = OtherTestObject
wrapped = factory.SubFactory(TestObjectFactory, two=2, four=4)
wrapped__two = 4
@@ -1145,18 +1145,18 @@ class SubFactoryTestCase(unittest.TestCase):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
class WrappingTestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
wrapped = factory.SubFactory(TestObjectFactory)
wrapped_bis = factory.SubFactory(TestObjectFactory, one=1)
class OuterWrappingTestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
wrap = factory.SubFactory(WrappingTestObjectFactory, wrapped__two=2)
@@ -1174,19 +1174,19 @@ class SubFactoryTestCase(unittest.TestCase):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
two = 'two'
class WrappingTestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
wrapped = factory.SubFactory(TestObjectFactory)
friend = factory.LazyAttribute(lambda o: o.wrapped.two.four + 1)
class OuterWrappingTestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
wrap = factory.SubFactory(WrappingTestObjectFactory,
wrapped__two=factory.SubFactory(TestObjectFactory, four=4))
@@ -1207,13 +1207,13 @@ class SubFactoryTestCase(unittest.TestCase):
# Innermost factory
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
two = 'two'
# Intermediary factory
class WrappingTestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
wrapped = factory.SubFactory(TestObjectFactory)
wrapped__two = 'three'
@@ -1232,12 +1232,12 @@ class SubFactoryTestCase(unittest.TestCase):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
two = 'two'
class WrappingTestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
wrapped = factory.SubFactory(TestObjectFactory)
friend = factory.LazyAttribute(lambda o: o.wrapped.two + 1)
@@ -1272,23 +1272,23 @@ class SubFactoryTestCase(unittest.TestCase):
class InnerMostFactory(factory.Factory):
class Meta:
- target = InnerMost
+ model = InnerMost
a = 15
b = 20
class SideAFactory(factory.Factory):
class Meta:
- target = SideA
+ model = SideA
inner_from_a = factory.SubFactory(InnerMostFactory, a=20)
class SideBFactory(factory.Factory):
class Meta:
- target = SideB
+ model = SideB
inner_from_b = factory.SubFactory(InnerMostFactory, b=15)
class OuterMostFactory(factory.Factory):
class Meta:
- target = OuterMost
+ model = OuterMost
foo = 30
side_a = factory.SubFactory(SideAFactory,
@@ -1314,13 +1314,13 @@ class SubFactoryTestCase(unittest.TestCase):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 3
two = factory.ContainerAttribute(lambda obj, containers: len(containers or []), strict=False)
class TestModel2Factory(FakeModelFactory):
class Meta:
- target = TestModel2
+ model = TestModel2
one = 1
two = factory.SubFactory(TestModelFactory, one=1)
@@ -1339,13 +1339,13 @@ class SubFactoryTestCase(unittest.TestCase):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 3
two = factory.ContainerAttribute(lambda obj, containers: len(containers or []), strict=True)
class TestModel2Factory(FakeModelFactory):
class Meta:
- target = TestModel2
+ model = TestModel2
one = 1
two = factory.SubFactory(TestModelFactory, one=1)
@@ -1362,7 +1362,7 @@ class SubFactoryTestCase(unittest.TestCase):
class TestModelFactory(FakeModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
one = 3
@factory.container_attribute
@@ -1373,7 +1373,7 @@ class SubFactoryTestCase(unittest.TestCase):
class TestModel2Factory(FakeModelFactory):
class Meta:
- target = TestModel2
+ model = TestModel2
one = 1
two = factory.SubFactory(TestModelFactory, one=1)
@@ -1392,7 +1392,7 @@ class IteratorTestCase(unittest.TestCase):
def test_iterator(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.Iterator(range(10, 30))
@@ -1406,7 +1406,7 @@ class IteratorTestCase(unittest.TestCase):
def test_iterator_list_comprehension_scope_bleeding(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.Iterator([j * 3 for j in range(5)])
@@ -1418,7 +1418,7 @@ class IteratorTestCase(unittest.TestCase):
def test_iterator_list_comprehension_protected(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.Iterator([_j * 3 for _j in range(5)])
@@ -1432,7 +1432,7 @@ class IteratorTestCase(unittest.TestCase):
def test_iterator_decorator(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
@factory.iterator
def one():
@@ -1483,7 +1483,7 @@ class DjangoModelFactoryTestCase(unittest.TestCase):
def test_simple(self):
class FakeModelFactory(factory.django.DjangoModelFactory):
class Meta:
- target = FakeModel
+ model = FakeModel
obj = FakeModelFactory(one=1)
self.assertEqual(1, obj.one)
@@ -1498,7 +1498,7 @@ class DjangoModelFactoryTestCase(unittest.TestCase):
class MyFakeModelFactory(factory.django.DjangoModelFactory):
class Meta:
- target = MyFakeModel
+ model = MyFakeModel
django_get_or_create = ('x',)
x = 1
y = 4
@@ -1520,7 +1520,7 @@ class DjangoModelFactoryTestCase(unittest.TestCase):
class MyFakeModelFactory(factory.django.DjangoModelFactory):
class Meta:
- target = MyFakeModel
+ model = MyFakeModel
django_get_or_create = ('x', 'y', 'z')
x = 1
y = 4
@@ -1542,7 +1542,7 @@ class DjangoModelFactoryTestCase(unittest.TestCase):
class MyFakeModelFactory(factory.django.DjangoModelFactory):
class Meta:
- target = MyFakeModel
+ model = MyFakeModel
django_get_or_create = ('x',)
x = 1
y = 4
@@ -1564,7 +1564,7 @@ class DjangoModelFactoryTestCase(unittest.TestCase):
class MyFakeModelFactory(factory.django.DjangoModelFactory):
class Meta:
- target = MyFakeModel
+ model = MyFakeModel
django_get_or_create = ('x', 'y', 'z')
x = 1
y = 4
@@ -1580,7 +1580,7 @@ class DjangoModelFactoryTestCase(unittest.TestCase):
def test_sequence(self):
class TestModelFactory(factory.django.DjangoModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
a = factory.Sequence(lambda n: 'foo_%s' % n)
@@ -1599,7 +1599,7 @@ class DjangoModelFactoryTestCase(unittest.TestCase):
def test_no_get_or_create(self):
class TestModelFactory(factory.django.DjangoModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
a = factory.Sequence(lambda n: 'foo_%s' % n)
@@ -1611,7 +1611,7 @@ class DjangoModelFactoryTestCase(unittest.TestCase):
def test_get_or_create(self):
class TestModelFactory(factory.django.DjangoModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
django_get_or_create = ('a', 'b')
a = factory.Sequence(lambda n: 'foo_%s' % n)
@@ -1631,7 +1631,7 @@ class DjangoModelFactoryTestCase(unittest.TestCase):
"""Test a DjangoModelFactory with all fields in get_or_create."""
class TestModelFactory(factory.django.DjangoModelFactory):
class Meta:
- target = TestModel
+ model = TestModel
django_get_or_create = ('a', 'b', 'c', 'd')
a = factory.Sequence(lambda n: 'foo_%s' % n)
@@ -1652,7 +1652,7 @@ class PostGenerationTestCase(unittest.TestCase):
def test_post_generation(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = 1
@@ -1671,7 +1671,7 @@ class PostGenerationTestCase(unittest.TestCase):
def test_post_generation_hook(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = 1
@@ -1693,7 +1693,7 @@ class PostGenerationTestCase(unittest.TestCase):
def test_post_generation_extraction(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = 1
@@ -1719,7 +1719,7 @@ class PostGenerationTestCase(unittest.TestCase):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
bar = factory.PostGeneration(my_lambda)
@@ -1739,7 +1739,7 @@ class PostGenerationTestCase(unittest.TestCase):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = 3
two = 2
post_call = factory.PostGenerationMethodCall('call', one=1)
@@ -1764,13 +1764,13 @@ class PostGenerationTestCase(unittest.TestCase):
class TestRelatedObjectFactory(factory.Factory):
class Meta:
- target = TestRelatedObject
+ model = TestRelatedObject
one = 1
two = factory.LazyAttribute(lambda o: o.one + 1)
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = 3
two = 2
three = factory.RelatedFactory(TestRelatedObjectFactory, name='obj')
@@ -1811,13 +1811,13 @@ class PostGenerationTestCase(unittest.TestCase):
class TestRelatedObjectFactory(factory.Factory):
class Meta:
- target = TestRelatedObject
+ model = TestRelatedObject
one = 1
two = factory.LazyAttribute(lambda o: o.one + 1)
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = 3
two = 2
three = factory.RelatedFactory(TestRelatedObjectFactory)
@@ -1859,11 +1859,11 @@ class RelatedFactoryExtractionTestCase(unittest.TestCase):
class TestRelatedObjectFactory(factory.Factory):
class Meta:
- target = TestRelatedObject
+ model = TestRelatedObject
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.RelatedFactory(TestRelatedObjectFactory, 'obj')
self.TestRelatedObject = TestRelatedObject
@@ -1911,7 +1911,7 @@ class DictTestCase(unittest.TestCase):
def test_empty_dict(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.Dict({})
o = TestObjectFactory()
@@ -1920,7 +1920,7 @@ class DictTestCase(unittest.TestCase):
def test_naive_dict(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.Dict({'a': 1})
o = TestObjectFactory()
@@ -1929,7 +1929,7 @@ class DictTestCase(unittest.TestCase):
def test_sequence_dict(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.Dict({'a': factory.Sequence(lambda n: n + 2)})
o1 = TestObjectFactory()
@@ -1941,7 +1941,7 @@ class DictTestCase(unittest.TestCase):
def test_dict_override(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.Dict({'a': 1})
o = TestObjectFactory(one__a=2)
@@ -1950,7 +1950,7 @@ class DictTestCase(unittest.TestCase):
def test_dict_extra_key(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.Dict({'a': 1})
o = TestObjectFactory(one__b=2)
@@ -1959,7 +1959,7 @@ class DictTestCase(unittest.TestCase):
def test_dict_merged_fields(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
two = 13
one = factory.Dict({
'one': 1,
@@ -1973,7 +1973,7 @@ class DictTestCase(unittest.TestCase):
def test_nested_dicts(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = 1
two = factory.Dict({
'one': 3,
@@ -2002,7 +2002,7 @@ class ListTestCase(unittest.TestCase):
def test_empty_list(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.List([])
o = TestObjectFactory()
@@ -2011,7 +2011,7 @@ class ListTestCase(unittest.TestCase):
def test_naive_list(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.List([1])
o = TestObjectFactory()
@@ -2020,7 +2020,7 @@ class ListTestCase(unittest.TestCase):
def test_sequence_list(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.List([factory.Sequence(lambda n: n + 2)])
o1 = TestObjectFactory()
@@ -2032,7 +2032,7 @@ class ListTestCase(unittest.TestCase):
def test_list_override(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.List([1])
o = TestObjectFactory(one__0=2)
@@ -2041,7 +2041,7 @@ class ListTestCase(unittest.TestCase):
def test_list_extra_key(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = factory.List([1])
o = TestObjectFactory(one__1=2)
@@ -2050,7 +2050,7 @@ class ListTestCase(unittest.TestCase):
def test_list_merged_fields(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
two = 13
one = factory.List([
1,
@@ -2064,7 +2064,7 @@ class ListTestCase(unittest.TestCase):
def test_nested_lists(self):
class TestObjectFactory(factory.Factory):
class Meta:
- target = TestObject
+ model = TestObject
one = 1
two = factory.List([