コード例 #1
0
    def delete_user(self):
        curr_user = self.selected_user
        if curr_user.isTeacher is False:
            curr_vm = cT.get_vm_object(curr_user.assigned_VM)
            user_response = messagebox.askokcancel(
                "Delete", "Are you sure you want to delete this user? "
                "This will result in the irreversible deletion of the "
                "associated VM.",
                parent=self)
            if user_response is False:
                print("Canceled")

            else:
                # delete current user VM
                cT.del_vm(curr_vm)
                # delete current user
                cT.del_user(curr_user)
                # refresh the list of students
                self.update_list()

        else:
            messagebox.showinfo(
                "Warning",
                "This is a teacher and cannot be removed this way.",
                parent=self)
        self.clear_form()
コード例 #2
0
 def tearDown(self) -> None:
     test_user = cT.user_by_id(self.user)
     test_vm = cT.get_vm_object(test_user.assigned_VM)
     cT.del_user(test_user)
     cT.del_vm(test_vm)