From 0e8d7d173ccff066a5ba377d57c82a653265518d Mon Sep 17 00:00:00 2001 From: danielfmiranda Date: Thu, 2 May 2024 23:53:54 -0700 Subject: [PATCH 1/3] created factory for ways to give page and added it to percy tests --- .../networkapi/donate/factory/__init__.py | 3 +- .../donate/factory/ways_to_give_page.py | 29 +++++++++++++++++++ tests/foundation-urls.js | 1 + 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 network-api/networkapi/donate/factory/ways_to_give_page.py diff --git a/network-api/networkapi/donate/factory/__init__.py b/network-api/networkapi/donate/factory/__init__.py index 2d5a4a89e66..4cf574d84e9 100644 --- a/network-api/networkapi/donate/factory/__init__.py +++ b/network-api/networkapi/donate/factory/__init__.py @@ -1,10 +1,11 @@ -from . import help_page, landing_page +from . import help_page, landing_page, ways_to_give_page def generate(seed): # these are not, and should not be, alphabetically ordered. landing_page.generate(seed) help_page.generate(seed) + ways_to_give_page.generate(seed) __all__ = [ diff --git a/network-api/networkapi/donate/factory/ways_to_give_page.py b/network-api/networkapi/donate/factory/ways_to_give_page.py new file mode 100644 index 00000000000..732b8668211 --- /dev/null +++ b/network-api/networkapi/donate/factory/ways_to_give_page.py @@ -0,0 +1,29 @@ +import wagtail_factories +from factory import Faker, SubFactory +from wagtail_factories import PageFactory + +from networkapi.donate.models import DonateLandingPage +from networkapi.wagtailpages.models import OpportunityPage +from networkapi.utility.faker import StreamfieldProvider +from networkapi.utility.faker.helpers import reseed + +Faker.add_provider(StreamfieldProvider) + +streamfield_fields = ["paragraph", "linkbutton", "spacer", "quote"] + + +class DonateWaysToGivePageFactory(PageFactory): + class Meta: + # Using OppurtunityPage AKA "Default Page" model + model = OpportunityPage + + title = Faker("sentence", nb_words=2) + body = Faker("streamfield", fields=streamfield_fields) + + +def generate(seed): + reseed(seed) + + print('Generating a Donate "Ways to give" page') + donate_home_page = DonateLandingPage.objects.get(title="Donate Now") + DonateWaysToGivePageFactory(parent=donate_home_page, title="Ways to Give", header="", slug="ways-to-give") diff --git a/tests/foundation-urls.js b/tests/foundation-urls.js index f46e8a3a19b..f207bd3f334 100644 --- a/tests/foundation-urls.js +++ b/tests/foundation-urls.js @@ -23,6 +23,7 @@ module.exports = { "/publication-page-with-chapter-pages/fixed-title-chapter-page/fixed-title-article-page", Donate: "/donate", "Donate Help": "/donate/help", + "Donate Ways To Give": "/donate/ways-to-give", PNI: "/privacynotincluded", "PNI (filtered for category)": "/privacynotincluded/categories/toys-games", "PNI general product page": "/privacynotincluded/general-percy-product", From 6023945504ff5dd7407c329fb7f041c26a8bc1fc Mon Sep 17 00:00:00 2001 From: danielfmiranda Date: Thu, 2 May 2024 23:54:54 -0700 Subject: [PATCH 2/3] formatting --- network-api/networkapi/donate/factory/ways_to_give_page.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/network-api/networkapi/donate/factory/ways_to_give_page.py b/network-api/networkapi/donate/factory/ways_to_give_page.py index 732b8668211..9864146d0d7 100644 --- a/network-api/networkapi/donate/factory/ways_to_give_page.py +++ b/network-api/networkapi/donate/factory/ways_to_give_page.py @@ -1,11 +1,10 @@ -import wagtail_factories -from factory import Faker, SubFactory +from factory import Faker from wagtail_factories import PageFactory -from networkapi.donate.models import DonateLandingPage -from networkapi.wagtailpages.models import OpportunityPage +from networkapi.donate.models import DonateLandingPage from networkapi.utility.faker import StreamfieldProvider from networkapi.utility.faker.helpers import reseed +from networkapi.wagtailpages.models import OpportunityPage Faker.add_provider(StreamfieldProvider) From 09e455c196fd9dc691c33b32a7c2a01579576970 Mon Sep 17 00:00:00 2001 From: danielfmiranda Date: Fri, 3 May 2024 14:58:13 -0700 Subject: [PATCH 3/3] fixed typo --- network-api/networkapi/donate/factory/ways_to_give_page.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network-api/networkapi/donate/factory/ways_to_give_page.py b/network-api/networkapi/donate/factory/ways_to_give_page.py index 9864146d0d7..ddf69ef3bff 100644 --- a/network-api/networkapi/donate/factory/ways_to_give_page.py +++ b/network-api/networkapi/donate/factory/ways_to_give_page.py @@ -13,7 +13,7 @@ class DonateWaysToGivePageFactory(PageFactory): class Meta: - # Using OppurtunityPage AKA "Default Page" model + # Using OpportunityPage AKA "Default Page" model model = OpportunityPage title = Faker("sentence", nb_words=2)