Skip to content

Commit

Permalink
[MC-1571] add defaultCategoryName to Fakespot feed
Browse files Browse the repository at this point in the history
  • Loading branch information
jpetto committed Oct 18, 2024
1 parent 31f9fbc commit 07d6256
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion merino/curated_recommendations/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ def validate_topics(cls, values):
return []


# Fakespot header/footer cta copy hardcoded strings for now.
# Fakespot UI copy - hardcoded strings for now.
FAKESPOT_DEFAULT_CATEGORY_NAME = "All products"
FAKESPOT_HEADER_COPY = (
"Fakespot by Mozilla curates the chaos of online shopping into gift guides you can trust."
)
Expand Down Expand Up @@ -169,6 +170,7 @@ class FakespotFeed(BaseModel):
"""Fakespot product recommendations"""

products: list[FakespotProduct]
defaultCategoryName: str
headerCopy: str
footerCopy: str
cta: FakespotCTA
Expand Down
2 changes: 2 additions & 0 deletions merino/curated_recommendations/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
CuratedRecommendationsBucket,
FakespotFeed,
FakespotProduct,
FAKESPOT_DEFAULT_CATEGORY_NAME,
FAKESPOT_HEADER_COPY,
FAKESPOT_FOOTER_COPY,
FAKESPOT_CTA_COPY,
Expand Down Expand Up @@ -191,6 +192,7 @@ def get_fakespot_feed() -> FakespotFeed:
)
return FakespotFeed(
products=fakespot_products,
defaultCategoryName=FAKESPOT_DEFAULT_CATEGORY_NAME,
headerCopy=FAKESPOT_HEADER_COPY,
footerCopy=FAKESPOT_FOOTER_COPY,
cta=FakespotCTA(ctaCopy=FAKESPOT_CTA_COPY, url=FAKESPOT_CTA_URL),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from merino.curated_recommendations.prior_backends.protocol import PriorBackend
from merino.curated_recommendations.protocol import (
ExperimentName,
FAKESPOT_DEFAULT_CATEGORY_NAME,
FAKESPOT_HEADER_COPY,
FAKESPOT_FOOTER_COPY,
FAKESPOT_CTA_COPY,
Expand Down Expand Up @@ -700,7 +701,8 @@ def assert_fakespot_feed(fakespot_feed):
required_fields = ["id", "title", "category", "imageUrl", "url"]
for product in fakespot_products:
assert all(product.get(field) for field in required_fields)
# Assert the header, footer, cta copy are present
# Assert the default category name, header, footer, cta copy are present
assert fakespot_feed["defaultCategoryName"] == FAKESPOT_DEFAULT_CATEGORY_NAME
assert fakespot_feed["headerCopy"] == FAKESPOT_HEADER_COPY
assert fakespot_feed["footerCopy"] == FAKESPOT_FOOTER_COPY
assert fakespot_feed["cta"]["ctaCopy"] == FAKESPOT_CTA_COPY
Expand Down

0 comments on commit 07d6256

Please sign in to comment.