Merge pull request #37907 from KerollesFathy/workspace-route-conflict
fix: route conflict not detected when workspace matches existing doctype
This commit is contained in:
commit
9e93965315
2 changed files with 16 additions and 1 deletions
|
|
@ -13,6 +13,15 @@ class TestWorkspace(IntegrationTestCase):
|
|||
frappe.db.delete("DocType", {"module": "Test Module"})
|
||||
frappe.delete_doc("Module Def", "Test Module")
|
||||
|
||||
def test_workspace_conflicts_with_existing_doctype(self):
|
||||
"""Workspace name should not conflict with existing DocType names."""
|
||||
|
||||
create_doctype("Test", "Test Module")
|
||||
workspace = create_workspace(name="Test", label="Test", public=1, title="Test")
|
||||
|
||||
with self.assertRaises(frappe.NameError):
|
||||
workspace.insert()
|
||||
|
||||
# TODO: FIX ME - flaky test!!!
|
||||
# def test_workspace_with_cards_specific_to_a_country(self):
|
||||
# workspace = create_workspace()
|
||||
|
|
@ -65,6 +74,8 @@ def create_workspace(**args):
|
|||
workspace.category = args.category or "Modules"
|
||||
workspace.is_standard = args.is_standard or 1
|
||||
workspace.module = "Test Module"
|
||||
workspace.public = args.public or 0
|
||||
workspace.title = args.title or "Test Workspace"
|
||||
|
||||
return workspace
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,11 @@ def validate_route_conflict(doctype, name):
|
|||
all_names = []
|
||||
for _doctype in ["Page", "Workspace", "DocType"]:
|
||||
all_names.extend(
|
||||
[slug(d) for d in frappe.get_all(_doctype, pluck="name") if (doctype != _doctype and d != name)]
|
||||
[
|
||||
slug(d)
|
||||
for d in frappe.get_all(_doctype, pluck="name")
|
||||
if not (doctype == _doctype and d == name)
|
||||
]
|
||||
)
|
||||
|
||||
if slug(name) in all_names:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue