summaryrefslogtreecommitdiff
path: root/tests/test_using.py
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2012-01-12 13:30:41 -0800
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2012-01-12 13:30:41 -0800
commit74225f59761ed3e09b625d9886552bdafb0fc30d (patch)
tree03c9204a5425f5ec3413f69ea09d1ad835b12ac1 /tests/test_using.py
parent363fa7b470286f2b38ab33a7e986bfd000f25d86 (diff)
parent5bdc19ccbde3934a05b11a0d0edf50d3b31e930d (diff)
downloadfactory-boy-74225f59761ed3e09b625d9886552bdafb0fc30d.tar
factory-boy-74225f59761ed3e09b625d9886552bdafb0fc30d.tar.gz
Merge pull request #4 from carljm/allow-public-classmethods
Allow public classmethods/staticmethods on factories.
Diffstat (limited to 'tests/test_using.py')
-rw-r--r--tests/test_using.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_using.py b/tests/test_using.py
index e0e59cd..d1e4262 100644
--- a/tests/test_using.py
+++ b/tests/test_using.py
@@ -280,6 +280,22 @@ class FactoryTestCase(unittest.TestCase):
test_object = TestModelFactory.create()
self.assertEqual(test_object, "This doesn't even return an instance of TestModel")
+ def testClassMethodAccessible(self):
+ class TestObjectFactory(factory.Factory):
+ @classmethod
+ def alt_create(cls, **kwargs):
+ return kwargs
+
+ self.assertEqual(TestObjectFactory.alt_create(foo=1), {"foo": 1})
+
+ def testStaticMethodAccessible(self):
+ class TestObjectFactory(factory.Factory):
+ @staticmethod
+ def alt_create(**kwargs):
+ return kwargs
+
+ self.assertEqual(TestObjectFactory.alt_create(foo=1), {"foo": 1})
+
class SubFactoryTestCase(unittest.TestCase):
def testSubFactory(self):