Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
(cherry picked from commit c2f43c4) Co-authored-by: Ankush Menat <ankush@frappe.io>
- Loading branch information
1 parent
cb4d825
commit 9e29a94
Showing
2 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
31 changes: 29 additions & 2 deletions
31
frappe/website/doctype/website_settings/test_website_settings.py
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 |
---|---|---|
@@ -1,8 +1,35 @@ | ||
# Copyright (c) 2020, Frappe Technologies and Contributors | ||
# License: MIT. See LICENSE | ||
# import frappe | ||
|
||
import frappe | ||
from frappe.tests.utils import FrappeTestCase | ||
from frappe.website.doctype.website_settings.website_settings import get_website_settings | ||
|
||
|
||
class TestWebsiteSettings(FrappeTestCase): | ||
pass | ||
def test_child_items_in_top_bar(self): | ||
ws = frappe.get_doc("Website Settings") | ||
ws.append( | ||
"top_bar_items", | ||
{"label": "Parent Item"}, | ||
) | ||
ws.append( | ||
"top_bar_items", | ||
{"parent_label": "Parent Item", "label": "Child Item"}, | ||
) | ||
ws.save() | ||
|
||
context = get_website_settings() | ||
|
||
for item in context.top_bar_items: | ||
if item.label == "Parent Item": | ||
self.assertEqual(item.child_items[0].label, "Child Item") | ||
break | ||
else: | ||
self.fail("Child items not found") | ||
|
||
def test_redirect_setups(self): | ||
ws = frappe.get_doc("Website Settings") | ||
|
||
ws.append("route_redirects", {"source": "/engineering/(*.)", "target": "/development/(*.)"}) | ||
self.assertRaises(frappe.ValidationError, ws.validate) |
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