Issue #3054
closedTask cancelation via REST API does not work
Description
This detail route should allow a task to be canceled with a POST to the endpoint `/v3/tasks/<task_id>/cancel/`
Expected: (204 if successful, 404 if task doesnt exist)
Actual: (405).
Suspecting that this was because POST was disallowed for the whole viewset, I added 'post' to this list:
https://github.com/pulp/pulp/blob/253ae59c9d80a4698c47a0608f96e5d81a62f0d7/platform/pulpcore/app/viewsets/task.py#L27
Sure enough, this allowed me to pass POST the cancel endpoint (but it also incorrectly allowed POST at v3/tasks/)
I found another small error that will interfere with fixing this issue. The constant for a 204 is `HTTP_204_NO_CONTENT`. https://github.com/pulp/pulp/blob/253ae59c9d80a4698c47a0608f96e5d81a62f0d7/platform/pulpcore/app/viewsets/task.py#L33
I think that this proves that the pattern of "Use NamedModelViewset and disallow extraneous methods" will not work. I think each viewset should inherit directly from all of the mixins that it needs, directly.
Related issues
fix task cancel
closes #3054