Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/api/cms/page/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def get_block_union():
import glob

# Import all blocks to register them
for file_ in glob.glob("api/cms/*/blocks/*.py"):
for file_ in sorted(glob.glob("api/cms/*/blocks/*.py")):
module_path = file_.replace("/", ".").replace(".py", "")
importlib.import_module(module_path)

Expand Down
37 changes: 37 additions & 0 deletions backend/api/cms/tests/test_registry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from unittest.mock import call, patch

import strawberry

from api.cms.page.registry import REGISTRY, get_block_union


def test_get_block_union_imports_blocks_in_sorted_order():
@strawberry.type
class FirstBlock:
value: str

@strawberry.type
class SecondBlock:
value: str

with (
patch(
"glob.glob",
return_value=[
"api/cms/page/blocks/second.py",
"api/cms/page/blocks/first.py",
],
),
patch("importlib.import_module") as import_module,
patch.dict(
REGISTRY,
{"first": FirstBlock, "second": SecondBlock},
clear=True,
),
):
get_block_union()

assert import_module.call_args_list == [
call("api.cms.page.blocks.first"),
call("api.cms.page.blocks.second"),
]
2 changes: 1 addition & 1 deletion backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ dependencies = [
"django-queryinspect<2.0.0,>=1.1.0",
"lxml==6.1.0",
"unidecode<2.0.0,>=1.1.1",
"strawberry-graphql==0.318.1",
"strawberry-graphql==0.324.0",
"Werkzeug>=1.0.1,<4.0.0",
"django-import-export<4.0.0,>=3.2.0",
"dal-admin-filters==1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion backend/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ type BillingAddress {
pec: String!
}

union Block = NewsGridSection | CommunitiesSection | SliderCardsSection | SponsorsSection | SchedulePreviewSection | TextSection | DynamicContentDisplaySection | SpecialGuestSection | LiveStreamingSection | InformationSection | CheckoutSection | SocialsSection | KeynotersSection | HomepageHero | HomeIntroSection | CMSMap
union Block = CMSMap | HomeIntroSection | NewsGridSection | CheckoutSection | CommunitiesSection | DynamicContentDisplaySection | HomepageHero | InformationSection | KeynotersSection | LiveStreamingSection | SchedulePreviewSection | SliderCardsSection | SocialsSection | SpecialGuestSection | SponsorsSection | TextSection

enum BodyTextSize {
TEXT_1
Expand Down
8 changes: 4 additions & 4 deletions backend/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading