class MyTestPageWithStreamFieldFactory(wagtail_factories.PageFactory): body = wagtail_factories.StreamFieldFactory({ 'char_array': wagtail_factories.ListBlockFactory(wagtail_factories.CharBlockFactory), 'int_array': wagtail_factories.ListBlockFactory( wagtail_factories.IntegerBlockFactory), 'struct': MyBlockFactory, 'image': wagtail_factories.ImageChooserBlockFactory }) class Meta: model = models.MyTestPage
class MyTestPageWithStreamFieldFactory(wagtail_factories.PageFactory): body = wagtail_factories.StreamFieldFactory({ "char_array": wagtail_factories.ListBlockFactory(wagtail_factories.CharBlockFactory), "int_array": wagtail_factories.ListBlockFactory( wagtail_factories.IntegerBlockFactory), "struct": MyBlockFactory, "image": wagtail_factories.ImageChooserBlockFactory, }) class Meta: model = models.MyTestPage
class MyBlockFactory(wagtail_factories.StructBlockFactory): title = "my title" item = factory.SubFactory(MyBlockItemFactory) items = wagtail_factories.ListBlockFactory(MyBlockItemFactory) image = factory.SubFactory(wagtail_factories.ImageChooserBlockFactory) class Meta: model = models.MyBlock
class SearchBlockFactory(wagtail_factories.StructBlockFactory): filters = wagtail_factories.ListBlockFactory(_FilterItemFactory) tags = [] class Meta: model = SearchBlock
class TilesBlockFactory(wagtail_factories.StructBlockFactory): images = wagtail_factories.ListBlockFactory(_ServiceItemFactory) class Meta: model = TilesBlock