influxdata / Litmus

testing framework
0 stars 0 forks source link

Delete Tasks API #162

Closed gshif closed 5 years ago

gshif commented 5 years ago
kevinhogan111 commented 5 years ago

We should be able to successfully delete all of the following types of tasks, a successful DELETE request to /tasks/{taskID} should return a 204 per the swagger doc.

Tasks that have been created w different flux options:

1) ensure getting task by valid id that contains every flux option, where the every value is updated to increase by 30 seconds returns a 200. 2) ensure getting task by valid id that contains every cron option, where the cron value is increased by 30 seconds returns a 200. 3) ensure getting task by valid id that contains every and offset flux options, where the offset value is increased by 30 seconds returns a 200. 4) ensure getting task by valid id that contains every and offset flux options, where the offset value AND every value are increased by 30 seconds, returns a 200. Ensure you can delete a task by valid id that contains every flux option. Ensure you can delete a task by valid id that contains cron flux option. Ensure you can delete a task by valid id that contains every and offset flux options. Ensure you can delete a task by valid id that contains cron and offset flux options.

kevinhogan111 commented 5 years ago
>>> import requests
>>> task = requests.get('http://localhost:9999/api/v2/tasks/03ae3ec228d8e000', headers= {'Authorization': u'Token 2yzQBsqjIdqs6cgeTBGzsc1q4Tnx30oc154ULFFmKYf6IjJB1tsNpF50ClCVMJ7rQGxUMUkbZWVazOmnzLaOGQ=='})
>>>
>>> task.json
<bound method Response.json of <Response [200]>>
>>> task.text
u'{"links":{"labels":"/api/v2/tasks/03ae3ec228d8e000/labels","logs":"/api/v2/tasks/03ae3ec228d8e000/logs","members":"/api/v2/tasks/03ae3ec228d8e000/members","owners":"/api/v2/tasks/03ae3ec228d8e000/owners","runs":"/api/v2/tasks/03ae3ec228d8e000/runs","self":"/api/v2/tasks/03ae3ec228d8e000"},"labels":[],"id":"03ae3ec228d8e000","orgID":"03ae3ec0df42d000","org":"I49hzs3wc7N5","authorizationID":"03ae3ebfe182d000","name":"test_get_updated_task_by_id_cron_every_1hour_to_every_2hour ","status":"active","flux":"option task = {name: \\"test_get_updated_task_by_id_cron_every_1hour_to_every_2hour \\", cron: \\"0 2 * * *\\"}\\n\\nfrom(bucket: \\"rgGxE5WLvgFN\\")\\n\\t|\\u003e range(start: -1h)\\n\\t|\\u003e to(bucket: \\"rgGxE5WLvgFN\\", orgID: \\"03ae3ec0df42d000\\")","cron":"0 2 * * *","latestCompleted":"2019-04-10T20:43:21Z","createdAt":"2019-04-10T20:43:21Z","updatedAt":"2019-04-10T20:43:21Z"}\n'
>>>
>>>
>>>
>>> del_task = requests.delete('http://localhost:9999/api/v2/tasks/03ae3ec228d8e000', headers= {'Authorization': u'Token 2yzQBsqjIdqs6cgeTBGzsc1q4Tnx30oc154ULFFmKYf6IjJB1tsNpF50ClCVMJ7rQGxUMUkbZWVazOmnzLaOGQ=='})
>>> del_task.json
<bound method Response.json of <Response [204]>>
>>> del_task.text
u''
>>> task = requests.get('http://localhost:9999/api/v2/tasks/03ae3ec228d8e000', headers= {'Authorization': u'Token 2yzQBsqjIdqs6cgeTBGzsc1q4Tnx30oc154ULFFmKYf6IjJB1tsNpF50ClCVMJ7rQGxUMUkbZWVazOmnzLaOGQ=='})
>>> task.json
<bound method Response.json of <Response [404]>>
>>> del_task.status_code
204
>>> del_task.json
<bound method Response.json of <Response [204]>>
>>> del_task.text
u'
kevinhogan111 commented 5 years ago

The code for this has been merged into master, https://github.com/influxdata/idpe/pull/3142