autofactory.django.builders.from_default

Here are the examples of the python api autofactory.django.builders.from_default taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

0 Source : test_django.py
with MIT License
from nickgashkov

    def test_patching_registry_changes_builders(self):
        def setUp():
            # Has to be this way to encapsulate test.
            registry.register(FROM_DEFAULT, lambda x: "PATCHED DEFAULT")

        def tearDown():
            registry.register(FROM_DEFAULT, builders.from_default)

        setUp()

        class PatchedDefaultFactory(DjangoModelAutoFactory):
            class Meta:
                model = WithDefault
                autofields = "__all__"

        with_default = PatchedDefaultFactory.create()
        self.assertEqual(with_default.string_with_default, "PATCHED DEFAULT")

        tearDown()

    def test_autofactory_from_shortcut_has_classname_like_ModelFactory(self):