How Can You Create an Admin User with Factory_Boy?

If you subclass factory.DjangoModelFactory it should save the user object for you. See the note section under PostGenerationMethodCall. Then you only need to do the following: class UserFactory(factory.DjangoModelFactory): FACTORY_FOR = User email=”admin@admin.com” username=”admin” password = factory.PostGenerationMethodCall(‘set_password’, ‘adm1n’) is_superuser = True is_staff = True is_active = True