Skip to content

Commit

Permalink
chore: conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ankush committed Apr 22, 2024
1 parent 73c0747 commit 26eb2bc
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions frappe/tests/test_permissions.py
Expand Up @@ -711,43 +711,13 @@ def test_select_user(self):
self.assertNotIn("test1@example.com", users)
self.assertIn("test2@example.com", users)
self.assertIn("test3@example.com", users)
<<<<<<< HEAD
=======

def test_automatic_permissions(self):
def assertHasRole(*roles: str | tuple[str, ...]):
for role in roles:
self.assertIn(role, frappe.get_roles())

frappe.set_user("Administrator")
assertHasRole(*AUTOMATIC_ROLES)

frappe.set_user("Guest")
assertHasRole(GUEST_ROLE)

website_user = frappe.db.get_value(
"User",
{"user_type": "Website User", "enabled": 1, "name": ("not in", AUTOMATIC_ROLES)},
)
frappe.set_user(website_user)
assertHasRole(GUEST_ROLE, ALL_USER_ROLE)

system_user = frappe.db.get_value(
"User",
{"user_type": "System User", "enabled": 1, "name": ("not in", AUTOMATIC_ROLES)},
)
frappe.set_user(system_user)
assertHasRole(GUEST_ROLE, ALL_USER_ROLE, SYSTEM_USER_ROLE)

def test_get_doctypes_with_read(self):
with self.set_user("Administrator"):
doctype = new_doctype(permissions=[{"select": 1, "role": "_Test Role", "read": 0}]).insert().name

with self.set_user("test@example.com"):
self.assertNotIn(doctype, get_doctypes_with_read())
<<<<<<< HEAD
>>>>>>> a1bb734079 (fix: filter select perm in get_doctypes_with_read)
=======

def test_overrides_work_as_expected(self):
"""custom docperms should completely override standard ones"""
Expand All @@ -767,4 +737,3 @@ def test_overrides_work_as_expected(self):
with self.set_user("test@example.com"):
# No one has this role, so user shouldn't have permission.
self.assertNotIn(doctype, get_doctypes_with_read())
>>>>>>> 3f707f1ae1 (test: add test for custom docperm behaviour)

0 comments on commit 26eb2bc

Please sign in to comment.