From d7cfd977a3f1d48c4bb635a4c4a3a8aa8667eca1 Mon Sep 17 00:00:00 2001 From: Romain Ziba Date: Tue, 2 Jun 2015 15:31:55 +0200 Subject: [PATCH] Test starts the task after stopping it Change-Id: I40c75232762ee93771b20d692e88f83cbc7868ce --- cerberus/tests/functional/api/v1/test_api.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/cerberus/tests/functional/api/v1/test_api.py b/cerberus/tests/functional/api/v1/test_api.py index 88db6fa..fab697a 100644 --- a/cerberus/tests/functional/api/v1/test_api.py +++ b/cerberus/tests/functional/api/v1/test_api.py @@ -155,7 +155,7 @@ class TaskTestsV1(base.TestCase): ) self.assertEqual(204, resp.status) - def test_create_get_stop_delete_recurrent_task_persistent(self): + def test_create_get_stop_start_delete_recurrent_task_persistent(self): # Get test_plugin plugin_id = None @@ -217,6 +217,22 @@ class TaskTestsV1(base.TestCase): self.assertEqual('stopped', json.loads(body)['state']) self.assertEqual(3, json.loads(body)['period']) + # Start the task + resp, body = self.security_client.post( + self.security_client._version + '/tasks/' + task_id + + '/action/restart', json.dumps({}), headers=headers) + self.assertEqual(204, resp.status) + + resp, body = self.security_client.get( + self.security_client._version + '/tasks/' + task_id, + headers=headers) + self.assertEqual(200, resp.status) + self.assertEqual(task_id, json.loads(body)['id']) + self.assertEqual('True', json.loads(body)['persistent']) + self.assertEqual('recurrent', json.loads(body)['type']) + self.assertEqual('running', json.loads(body)['state']) + self.assertEqual(3, json.loads(body)['period']) + # Delete the task resp, body = self.security_client.delete( self.security_client._version + '/tasks/' + task_id,