from factory import Factory, Faker, SubFactory from core_notifications.models import Template class TemplateFactory(Factory): class Meta: model = Template name = Faker("pystr") subject = Faker("pystr") source = "{{ test_var }}" context = '{"test_var": "test_var_value"}' created_by = SubFactory( "tests.core_notifications.factories.DNAAccountFactory" )