Bug 52973 - updateschools.py is missing a --rm $OU option
updateschools.py is missing a --rm $OU option
Status: NEW
Product: UCS@school
Classification: Unclassified
Component: Ucsschool-lib
UCS@school 4.4
Other Linux
: P5 normal (vote)
: ---
Assigned To: UCS@school maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-03-22 14:11 CET by Joerg Baach
Modified: 2023-06-23 13:36 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Feature Request
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joerg Baach univentionstaff 2021-03-22 14:11:16 CET
In the school_creation.py listener I'd also like to react to removal of schools by deleting it from the http_api database. For this a --rm option would be needed. 

The  file for this is ucs-school-import/modules/ucsschool/http_api/import_api/management/commands/updateschools.py. The school could be removed with a call to School.objects.get(name=name).delete(). Testing could look like this:

with UcsSchoolTest..() as schoolenv:
   neueou = schoolenv.create_ou(cache=False)
   # post-create-hook should have added OU to DB
   assert neueou in Popen("manage.py shell -c 'print(School.objects.all())'")
   # post-delete-hook should have removed OU from DB
   assert neueou not in Popen("manage.py shell -c 'print(School.objects.all())'")