diff --git a/tests/records/test_records.py b/tests/records/test_records.py index 5e99128..d8ab507 100644 --- a/tests/records/test_records.py +++ b/tests/records/test_records.py @@ -146,3 +146,23 @@ def test_delete_all(module_scoped_pages_fixture, base_app): Page.delete_all() pages = Page.search(map_search_params(PageServiceConfig.search, {}), []) assert len(pages.items) == 0 + + +def test_has_custom_view_true_unregistered_url(module_scoped_pages_fixture, base_app): + data = { + "url": "/custom-view", + "title": "Custom View", + "content": "Content for Custom View", + "description": "Description for Custom View", + "template_name": "invenio_pages/default.html", + "has_custom_view": True, # Set has_custom_view to True + } + page = Page.create(data) + + assert page.has_custom_view is True + assert page.url == "/custom-view" + assert page.title == "Custom View" + + # Verify that trying to retrieve the page by its URL will raise PageNotFoundError + with pytest.raises(PageNotFoundError): + Page.get_by_url("/custom-view")