summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polyconseil.fr>2014-06-23 11:09:53 +0200
committerRaphaël Barrois <raphael.barrois@polyconseil.fr>2014-06-23 11:09:53 +0200
commite2ef7c96ed74b35b9dec75a7f222b6ffa9214c10 (patch)
tree864605e4587bc41c6814cf1013f960c261a624ed /tests
parent6269fef31787aba4956612febfa3f4944fda947b (diff)
downloadfactory-boy-e2ef7c96ed74b35b9dec75a7f222b6ffa9214c10.tar
factory-boy-e2ef7c96ed74b35b9dec75a7f222b6ffa9214c10.tar.gz
Fix declaration inheritance.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_using.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/test_using.py b/tests/test_using.py
index e20f949..f18df4d 100644
--- a/tests/test_using.py
+++ b/tests/test_using.py
@@ -766,6 +766,37 @@ class UsingFactoryTestCase(unittest.TestCase):
test_object_alt = TestObjectFactory.build()
self.assertEqual(None, test_object_alt.three)
+ def test_override_inherited(self):
+ """Overriding inherited declarations"""
+ class TestObjectFactory(factory.Factory):
+ class Meta:
+ model = TestObject
+
+ one = 'one'
+
+ class TestObjectFactory2(TestObjectFactory):
+ one = 'two'
+
+ test_object = TestObjectFactory2.build()
+ self.assertEqual('two', test_object.one)
+
+ def test_override_inherited_deep(self):
+ """Overriding inherited declarations"""
+ class TestObjectFactory(factory.Factory):
+ class Meta:
+ model = TestObject
+
+ one = 'one'
+
+ class TestObjectFactory2(TestObjectFactory):
+ one = 'two'
+
+ class TestObjectFactory3(TestObjectFactory2):
+ pass
+
+ test_object = TestObjectFactory3.build()
+ self.assertEqual('two', test_object.one)
+
def test_inheritance_and_sequences(self):
"""Sequence counters should be kept within an inheritance chain."""
class TestObjectFactory(factory.Factory):