예제 #1
0
 def test_generate_create(self):
     obj = factory.generate(FakeDjangoModel, factory.CREATE_STRATEGY, foo='bar')
     self.assertEqual(obj.id, 1)
     self.assertEqual(obj.foo, 'bar')
예제 #2
0
 def test_generate_stub(self):
     obj = factory.generate(FakeDjangoModel, factory.STUB_STRATEGY, foo='bar')
     self.assertFalse(hasattr(obj, 'id'))
     self.assertEqual(obj.foo, 'bar')
예제 #3
0
 def test_generate_build(self):
     obj = factory.generate(FakeDjangoModel, factory.BUILD_STRATEGY, foo='bar')
     self.assertEqual(obj.id, None)
     self.assertEqual(obj.foo, 'bar')
예제 #4
0
 def test_generate_stub(self):
     obj = factory.generate(FakeModel, factory.STUB_STRATEGY, foo='bar')
     self.assertFalse(hasattr(obj, 'id'))
     self.assertEqual(obj.foo, 'bar')
예제 #5
0
 def test_generate_create(self):
     obj = factory.generate(FakeModel, factory.CREATE_STRATEGY, foo='bar')
     self.assertEqual(obj.id, 2)
     self.assertEqual(obj.foo, 'bar')
예제 #6
0
 def test_generate_build(self):
     obj = factory.generate(FakeModel, factory.BUILD_STRATEGY, foo='bar')
     self.assertEqual(obj.id, None)
     self.assertEqual(obj.foo, 'bar')
예제 #7
0
 def test_generate_create_custom_base(self):
     obj = factory.generate(FakeModel, factory.CREATE_STRATEGY, foo='bar',
             FACTORY_CLASS=factory.DjangoModelFactory)
     self.assertEqual(obj.id, 2)
     self.assertEqual(obj.foo, 'bar')