-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Add factory for AppInstallPage (#12581)
* Feature: Add factory for AppInstallPage * Feature: Delete Video URL and add buttons for AppInstallPage * Refactor: Move AppInstallPageFactory to a separate file * Feature: Move AppInstallPage to it's own slug under homepage * Refactor: Delete unused imports in youtube_regrets_poage.py
- Loading branch information
1 parent
52a2fdb
commit a9fe180
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
network-api/networkapi/wagtailpages/factory/app_install_page.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from factory import Faker, SubFactory | ||
from wagtail_factories import PageFactory | ||
|
||
from networkapi.utility.faker.helpers import reseed | ||
from networkapi.wagtailpages import models as pagemodels | ||
from networkapi.wagtailpages.factory import image_factory | ||
from networkapi.wagtailpages.models import AppInstallPage | ||
|
||
from .petition import PetitionFactory | ||
|
||
|
||
class AppInstallPageFactory(PageFactory): | ||
class Meta: | ||
model = AppInstallPage | ||
exclude = ( | ||
"title_text", | ||
"header_text", | ||
"header", | ||
) | ||
|
||
title = "Regrets Reporter Page" | ||
slug = "regretsreporter" | ||
hero_heading = Faker("text", max_nb_chars=50) | ||
hero_subheading = Faker("text", max_nb_chars=50) | ||
hero_background = SubFactory(image_factory.ImageFactory) | ||
download_buttons = Faker("streamfield", fields=["app_install_download_button"] * 2) | ||
cta = SubFactory(PetitionFactory) | ||
body = Faker("streamfield", fields=["header", "paragraph", "image", "spacer", "image_text", "quote"]) | ||
|
||
|
||
def generate(seed): | ||
reseed(seed) | ||
|
||
print("Generating PNI Homepage") | ||
AppInstallPageFactory.create( | ||
parent=pagemodels.Homepage.objects.first(), | ||
title="App Install Page", | ||
slug="app-install-page", | ||
) |