-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for wagtail hook icon registration (#52)
- Loading branch information
1 parent
1d8d4b3
commit 359ecf3
Showing
3 changed files
with
32 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
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
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,18 @@ | ||
from __future__ import annotations | ||
|
||
import itertools | ||
|
||
from django.template.utils import get_app_template_dirs | ||
from wagtail import hooks | ||
|
||
|
||
def test_register_icons(): | ||
icon_hooks = hooks.get_hooks("register_icons") | ||
all_icons = sorted(itertools.chain.from_iterable(hook([]) for hook in icon_hooks)) | ||
|
||
app_template_dirs = get_app_template_dirs("templates") | ||
template_files = [ | ||
str(filepath) for dir_ in app_template_dirs for filepath in dir_.rglob("*") | ||
] | ||
|
||
assert all(icon in template_files for icon in all_icons) |