MCPcopy Create free account
hub / github.com/FactoryBoy/factory_boy / test_custom_create

Method test_custom_create

tests/test_using.py:440–457  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

438 self.assertEqual('one2', o4.one)
439
440 def test_custom_create(self):
441 class TestModelFactory(factory.Factory):
442 class Meta:
443 model = TestModel
444
445 two = 2
446
447 @classmethod
448 def _create(cls, model_class, *args, **kwargs):
449 obj = model_class.create(**kwargs)
450 obj.properly_created = True
451 return obj
452
453 obj = TestModelFactory.create(one=1)
454 self.assertEqual(1, obj.one)
455 self.assertEqual(2, obj.two)
456 self.assertEqual(1, obj.id)
457 self.assertTrue(obj.properly_created)
458
459 def test_non_django_create(self):
460 class NonDjango:

Callers

nothing calls this directly

Calls 1

createMethod · 0.45

Tested by

no test coverage detected