Ejemplo n.º 1
0
 def test_get_permissions(self):
     component = Permissions(Mock())
     perms = [
         ["change_page", "cms", "page"],
         ["delete_page", "cms", "page"],
         ["use_structure", "cms", "placeholder"],
         ["change_user", "auth", "user"],
     ]
     result = component.get_permissions(perms)
     self.assertEqual(result.count(), 4)
     self.assertEqual(set(p.natural_key() for p in result),
                      set(tuple(p) for p in perms))
Ejemplo n.º 2
0
 def test_get_permissions_missing_content_types_are_ignored(self):
     component = Permissions(Mock())
     result = component.get_permissions(
         [["change_page", "cms_like_app", "yet_another_page_model"]])
     self.assertFalse(result.exists())
Ejemplo n.º 3
0
 def test_get_permissions_none(self):
     component = Permissions(Mock())
     result = component.get_permissions([])
     self.assertFalse(result.exists())