Skip to content

Commit

Permalink
test: added cusyom_view test
Browse files Browse the repository at this point in the history
  • Loading branch information
Fatimah committed Feb 20, 2024
1 parent 7430764 commit 461198d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/records/test_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit 461198d

Please sign in to comment.