diff options
Diffstat (limited to 'tests/test_using.py')
-rw-r--r-- | tests/test_using.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_using.py b/tests/test_using.py index ad62113..38c9e9e 100644 --- a/tests/test_using.py +++ b/tests/test_using.py @@ -365,6 +365,23 @@ class UsingFactoryTestCase(unittest.TestCase): self.assertEqual(3, test_object.four) self.assertEqual(5, test_object.five) + def testSelfAttributeParent(self): + class TestModel2(FakeModel): + pass + + class TestModelFactory(FakeModelFactory): + FACTORY_FOR = TestModel + one = 3 + three = factory.SelfAttribute('..bar') + + class TestModel2Factory(FakeModelFactory): + FACTORY_FOR = TestModel2 + bar = 4 + two = factory.SubFactory(TestModelFactory, one=1) + + test_model = TestModel2Factory() + self.assertEqual(4, test_model.two.three) + def testSequenceDecorator(self): class TestObjectFactory(factory.Factory): FACTORY_FOR = TestObject |