Skip to content

Commit

Permalink
Created factory for donate's "Ways to give" page and added it to Perc…
Browse files Browse the repository at this point in the history
…y tests (#12297)

* created factory for ways to give page and added it to percy tests

* formatting

* fixed typo
  • Loading branch information
danielfmiranda authored May 8, 2024
1 parent 6c2a567 commit 1132a53
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
3 changes: 2 additions & 1 deletion network-api/networkapi/donate/factory/__init__.py
Original file line number Diff line number Diff line change
@@ -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__ = [
Expand Down
28 changes: 28 additions & 0 deletions network-api/networkapi/donate/factory/ways_to_give_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from factory import Faker
from wagtail_factories import PageFactory

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)

streamfield_fields = ["paragraph", "linkbutton", "spacer", "quote"]


class DonateWaysToGivePageFactory(PageFactory):
class Meta:
# Using OpportunityPage 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")
1 change: 1 addition & 0 deletions tests/foundation-urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 1132a53

Please sign in to comment.