diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2013-03-15 01:33:56 +0100 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2013-03-15 01:33:56 +0100 |
commit | 6e9bf5af909e1e164a294fd5589edc4fada06731 (patch) | |
tree | 7063b11f41d681de1e7498294a0cdda6ef234e14 /tests | |
parent | d63821daba2002b8c455777748007f7198d3d3bc (diff) | |
download | factory-boy-6e9bf5af909e1e164a294fd5589edc4fada06731.tar factory-boy-6e9bf5af909e1e164a294fd5589edc4fada06731.tar.gz |
Merge BaseFactoryMetaClass into FactoryMetaClass.
Also fix FACTORY_STRATEGY.
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_base.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/test_base.py b/tests/test_base.py index e86eae3..e12c0ae 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -108,13 +108,13 @@ class FactoryTestCase(unittest.TestCase): class FactoryDefaultStrategyTestCase(unittest.TestCase): def setUp(self): - self.default_strategy = base.Factory.default_strategy + self.default_strategy = base.Factory.FACTORY_STRATEGY def tearDown(self): - base.Factory.default_strategy = self.default_strategy + base.Factory.FACTORY_STRATEGY = self.default_strategy def testBuildStrategy(self): - base.Factory.default_strategy = base.BUILD_STRATEGY + base.Factory.FACTORY_STRATEGY = base.BUILD_STRATEGY class TestModelFactory(base.Factory): FACTORY_FOR = TestModel @@ -126,7 +126,7 @@ class FactoryDefaultStrategyTestCase(unittest.TestCase): self.assertFalse(test_model.id) def testCreateStrategy(self): - # Default default_strategy + # Default FACTORY_STRATEGY class TestModelFactory(FakeModelFactory): FACTORY_FOR = TestModel @@ -138,7 +138,7 @@ class FactoryDefaultStrategyTestCase(unittest.TestCase): self.assertTrue(test_model.id) def testStubStrategy(self): - base.Factory.default_strategy = base.STUB_STRATEGY + base.Factory.FACTORY_STRATEGY = base.STUB_STRATEGY class TestModelFactory(base.Factory): FACTORY_FOR = TestModel @@ -150,7 +150,7 @@ class FactoryDefaultStrategyTestCase(unittest.TestCase): self.assertFalse(hasattr(test_model, 'id')) # We should have a plain old object def testUnknownStrategy(self): - base.Factory.default_strategy = 'unknown' + base.Factory.FACTORY_STRATEGY = 'unknown' class TestModelFactory(base.Factory): FACTORY_FOR = TestModel @@ -165,11 +165,11 @@ class FactoryDefaultStrategyTestCase(unittest.TestCase): one = 'one' - TestModelFactory.default_strategy = base.CREATE_STRATEGY + TestModelFactory.FACTORY_STRATEGY = base.CREATE_STRATEGY self.assertRaises(base.StubFactory.UnsupportedStrategy, TestModelFactory) - TestModelFactory.default_strategy = base.BUILD_STRATEGY + TestModelFactory.FACTORY_STRATEGY = base.BUILD_STRATEGY self.assertRaises(base.StubFactory.UnsupportedStrategy, TestModelFactory) def test_change_strategy(self): @@ -179,7 +179,7 @@ class FactoryDefaultStrategyTestCase(unittest.TestCase): one = 'one' - self.assertEqual(base.CREATE_STRATEGY, TestModelFactory.default_strategy) + self.assertEqual(base.CREATE_STRATEGY, TestModelFactory.FACTORY_STRATEGY) class FactoryCreationTestCase(unittest.TestCase): @@ -193,7 +193,7 @@ class FactoryCreationTestCase(unittest.TestCase): class TestFactory(base.StubFactory): pass - self.assertEqual(TestFactory.default_strategy, base.STUB_STRATEGY) + self.assertEqual(TestFactory.FACTORY_STRATEGY, base.STUB_STRATEGY) def testInheritanceWithStub(self): class TestObjectFactory(base.StubFactory): @@ -204,7 +204,7 @@ class FactoryCreationTestCase(unittest.TestCase): class TestFactory(TestObjectFactory): pass - self.assertEqual(TestFactory.default_strategy, base.STUB_STRATEGY) + self.assertEqual(TestFactory.FACTORY_STRATEGY, base.STUB_STRATEGY) def testCustomCreation(self): class TestModelFactory(FakeModelFactory): |