@@ -0,0 +1,1296 @@
+%22%22%22%0A:Copyright: 2006-2017 Jochen Kupperschmidt%0A:License: Modified BSD, see LICENSE for details.%0A%22%22%22%0A%0Afrom byceps.services.authorization import service%0A%0Afrom tests.base import AbstractAppTestCase%0A%0A%0Aclass PermissionToRoleAssignmentTestCase(AbstractAppTestCase):%0A%0A    def setUp(self):%0A        super().setUp()%0A%0A        self.permission_id = 'board_topic_hide'%0A        self.permission = service.create_permission(self.permission_id,%0A                                                    self.permission_id)%0A%0A        self.role_id = 'board_moderator'%0A        self.role = service.create_role(self.role_id, self.role_id)%0A%0A    def test_assign_permission_to_role(self):%0A        permission_id = self.permission.id%0A        role_id = self.role.id%0A%0A        role_permission_ids_before = self.get_permission_ids_for_role(role_id)%0A        self.assertNotIn(self.permission_id, role_permission_ids_before)%0A%0A        service.assign_permission_to_role(permission_id, role_id)%0A%0A        role_permission_ids_after = self.get_permission_ids_for_role(role_id)%0A        self.assertIn(self.permission_id, role_permission_ids_after)%0A%0A    # -------------------------------------------------------------------- #%0A    # helpers%0A%0A    def get_permission_ids_for_role(self, role_id):%0A        return %7Bp.id for p in self.role.permissions%7D%0A

Test assignment of permissions to roles