This commit is contained in:
noy-solvin 2026-05-26 15:05:40 +00:00 committed by GitHub
commit f9d9b9514b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View file

@ -172,7 +172,7 @@ class Content:
def _has_valid_mandatory_properties(self) -> bool:
"""Test mandatory properties are set."""
for prop in self.mandatory_properties:
if not hasattr(self, prop):
if not hasattr(self, prop) or getattr(self, prop) in (None, ""):
logger.error(
"Skipping %s: could not find information about '%s'", self, prop
)

View file

@ -734,6 +734,16 @@ class TestArticle(TestBase):
custom_article = Article(**article_kwargs)
self.assertEqual("custom", custom_article.template)
def test_empty_title_invalid(self):
# articles with empty title should be invalid
settings = get_settings()
article_kwargs = self._copy_page_kwargs()
article_kwargs["metadata"]["title"] = ""
article_kwargs["metadata"]["date"] = datetime.datetime.now()
article_kwargs["settings"] = settings
article = Article(**article_kwargs)
self.assertFalse(article.is_valid())
def test_slugify_category_author(self):
settings = get_settings()
settings["SLUG_REGEX_SUBSTITUTIONS"] = [