Exemple #1
0
 def delete(self, person_id, department_id):
     """
     Remove a user from given department.
     ---
     tags:
     - Persons
     parameters:
       - in: path
         name: person_id
         required: True
         schema:
             type: UUID
             example: a24a6ea4-ce75-4665-a070-57453082c25
       - in: path
         name: department_id
         required: True
         schema:
             type: UUID
             example: a24a6ea4-ce75-4665-a070-57453082c25
     responses:
         204:
             description: User removed from given department
     """
     permissions.check_admin_permissions()
     try:
         department = tasks_service.get_department(department_id)
     except DepartmentNotFoundException:
         raise WrongParameterException(
             "Department ID matches no department"
         )
     persons_service.remove_from_department(department_id, person_id)
     return "", 204
Exemple #2
0
 def test_remove_from_department(self):
     person = self.person.serialize()
     department = self.department.serialize()
     persons_service.add_to_department(department["id"], person["id"])
     persons_service.remove_from_department(department["id"], person["id"])
     person = persons_service.get_person(person["id"])
     self.assertEqual(len(person["departments"]), 0)
Exemple #3
0
 def delete(self, person_id, department_id):
     permissions.check_admin_permissions()
     try:
         department = tasks_service.get_department(department_id)
     except DepartmentNotFoundException:
         raise WrongParameterException("Department ID matches no department")
     persons_service.remove_from_department(department_id, person_id)
     return "", 204