Ejemplo n.º 1
0
 def test_check_permissions_invalid(self):
     app.test_user_id = COG_ID
     model = dict_to_object({
         "cff_permissions": {
             app.get_current_user_id(): {
                 "Responses_View": True
             }
         }
     })
     for action in ("owner", "Responses_Edit", "Forms_Edit"):
         with self.subTest(action=action):
             with self.assertRaises(UnauthorizedError):
                 app.check_permissions(model, action)
     self.assertTrue(app.check_permissions(model, "Responses_View"))
Ejemplo n.º 2
0
 def test_check_permissions_owner(self):
     app.test_user_id = COG_ID
     model = dict_to_object(
         {"cff_permissions": {
             app.get_current_user_id(): {
                 "owner": True
             }
         }})
     for action in ("owner", "Responses_Edit", "Forms_Edit"):
         with self.subTest(action=action):
             self.assertTrue(app.check_permissions(model, action))
Ejemplo n.º 3
0
 def test_check_permissions_valid(self):
     app.test_user_id = COG_ID
     model = dict_to_object({
         "cff_permissions": {
             app.get_current_user_id(): {
                 "Responses_View": True,
                 "Responses_CheckIn": True
             }
         }
     })
     for action in ("Responses_View", ["Responses_View", "Responses_Edit"],
                    ["Form_Edit", "Responses_CheckIn"]):
         with self.subTest(action=action):
             self.assertTrue(app.check_permissions(model, action))