-
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.
Created factory for donate's "Ways to give" page and added it to Perc…
…y tests (#12297) * created factory for ways to give page and added it to percy tests * formatting * fixed typo
- Loading branch information
1 parent
6c2a567
commit 1132a53
Showing
3 changed files
with
31 additions
and
1 deletion.
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
28 changes: 28 additions & 0 deletions
28
network-api/networkapi/donate/factory/ways_to_give_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,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") |
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