Add negative functional tests
Change-Id: Ic903cc03267d11f691f1d84b3bb0a333a19a4255
This commit is contained in:
parent
13d9dcefbe
commit
fe78da3fcb
@ -77,6 +77,10 @@ class MistralClient(rest_client.RestClient):
|
|||||||
return self.get('/workbooks/{name}/executions/{execution}'.format(
|
return self.get('/workbooks/{name}/executions/{execution}'.format(
|
||||||
name=workbook_name, execution=execution_id))
|
name=workbook_name, execution=execution_id))
|
||||||
|
|
||||||
|
def update_execution(self, workbook_name, execution_id, put_body):
|
||||||
|
return self.put('/workbooks/{name}/executions/{execution}'.format(
|
||||||
|
name=workbook_name, execution=execution_id), json.dumps(put_body))
|
||||||
|
|
||||||
def get_tasks_list(self, workbook_name, execution_id):
|
def get_tasks_list(self, workbook_name, execution_id):
|
||||||
resp, body = self.get(
|
resp, body = self.get(
|
||||||
'/workbooks/{name}/executions/{execution}/tasks'.format(
|
'/workbooks/{name}/executions/{execution}/tasks'.format(
|
||||||
@ -94,6 +98,15 @@ class MistralClient(rest_client.RestClient):
|
|||||||
|
|
||||||
return resp, json.loads(body)
|
return resp, json.loads(body)
|
||||||
|
|
||||||
|
def update_task(self, workbook_name, execution_id, task_id, put_body):
|
||||||
|
resp, body = self.put(
|
||||||
|
'/workbooks/{name}/executions/{execution}/tasks/{task}'.format(
|
||||||
|
name=workbook_name,
|
||||||
|
execution=execution_id,
|
||||||
|
task=task_id), json.dumps(put_body))
|
||||||
|
|
||||||
|
return resp, json.loads(body)
|
||||||
|
|
||||||
|
|
||||||
class TestCase(tempest.test.BaseTestCase):
|
class TestCase(tempest.test.BaseTestCase):
|
||||||
|
|
||||||
@ -135,8 +148,13 @@ class TestCaseAdvanced(TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestCaseAdvanced, self).setUp()
|
super(TestCaseAdvanced, self).setUp()
|
||||||
|
|
||||||
self.server_ids = []
|
self.server_ids = []
|
||||||
|
|
||||||
|
self.client.create_obj('workbooks', 'test123')
|
||||||
|
self.obj.append(['workbooks', 'test123'])
|
||||||
|
self.client.upload_workbook_definition('test123')
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
super(TestCaseAdvanced, self).tearDown()
|
super(TestCaseAdvanced, self).tearDown()
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import testtools
|
||||||
|
import uuid
|
||||||
|
|
||||||
from tempest import exceptions
|
from tempest import exceptions
|
||||||
from tempest import test
|
from tempest import test
|
||||||
@ -120,15 +122,14 @@ class SanityTests(base.TestCase):
|
|||||||
self.client.get_workbook_definition,
|
self.client.get_workbook_definition,
|
||||||
'fksn')
|
'fksn')
|
||||||
|
|
||||||
|
@testtools.skip('https://bugs.launchpad.net/mistral/+bug/1325933')
|
||||||
|
@test.attr(type='negative')
|
||||||
|
def test_get_executions_list_from_nonexistent_workbook(self):
|
||||||
|
self.assertRaises(exceptions.NotFound, self.client.get_list_obj,
|
||||||
|
'workbooks/nonexistentworkbook/executions')
|
||||||
|
|
||||||
class ExecutionTests(base.TestCaseAdvanced):
|
|
||||||
|
|
||||||
def setUp(self):
|
class AdvancedTests(base.TestCaseAdvanced):
|
||||||
super(ExecutionTests, self).setUp()
|
|
||||||
|
|
||||||
self.client.create_obj('workbooks', 'test123')
|
|
||||||
self.obj.append(['workbooks', 'test123'])
|
|
||||||
self.client.upload_workbook_definition('test123')
|
|
||||||
|
|
||||||
@test.attr(type='positive')
|
@test.attr(type='positive')
|
||||||
def test_create_execution(self):
|
def test_create_execution(self):
|
||||||
@ -179,3 +180,61 @@ class ExecutionTests(base.TestCaseAdvanced):
|
|||||||
self.assertEqual(tasks[0], task)
|
self.assertEqual(tasks[0], task)
|
||||||
|
|
||||||
#TODO(smurashov): Need to add test which would check task update
|
#TODO(smurashov): Need to add test which would check task update
|
||||||
|
|
||||||
|
@testtools.skip('https://bugs.launchpad.net/mistral/+bug/1325914')
|
||||||
|
@test.attr(type='negative')
|
||||||
|
def test_create_execution_in_nonexistent_workbook(self):
|
||||||
|
self.assertRaises(exceptions.NotFound, self._create_execution,
|
||||||
|
'nonexistentworkbook', 'catchme')
|
||||||
|
|
||||||
|
def test_get_nonexistent_execution(self):
|
||||||
|
|
||||||
|
self.assertRaises(exceptions.NotFound, self.client.get_execution,
|
||||||
|
'test123', str(uuid.uuid4()))
|
||||||
|
|
||||||
|
@test.attr(type='negative')
|
||||||
|
def test_update_nonexistent_execution(self):
|
||||||
|
|
||||||
|
id = str(uuid.uuid4())
|
||||||
|
put_body = {
|
||||||
|
"id": id,
|
||||||
|
"state": "STOPPED"
|
||||||
|
}
|
||||||
|
|
||||||
|
self.assertRaises(exceptions.NotFound, self.client.update_execution,
|
||||||
|
'test123', id, put_body)
|
||||||
|
|
||||||
|
@testtools.skip('https://bugs.launchpad.net/mistral/+bug/1326287')
|
||||||
|
@test.attr(type='negative')
|
||||||
|
def test_get_tasks_list_of_nonexistent_execution(self):
|
||||||
|
|
||||||
|
self.assertRaises(exceptions.NotFound, self.client.get_tasks_list,
|
||||||
|
'test123', str(uuid.uuid4()))
|
||||||
|
|
||||||
|
|
||||||
|
class AdvancedNegativeTestsWithExecutionCreate(base.TestCaseAdvanced):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(AdvancedNegativeTestsWithExecutionCreate, self).setUp()
|
||||||
|
|
||||||
|
self.execution = self._create_execution('test123', 'aloha')[1]
|
||||||
|
|
||||||
|
@testtools.skip('https://bugs.launchpad.net/mistral/+bug/1326278')
|
||||||
|
@test.attr(type='negative')
|
||||||
|
def test_get_nonexistent_task(self):
|
||||||
|
self.assertRaises(exceptions.NotFound, self.client.get_task,
|
||||||
|
'test123', self.execution['id'], str(uuid.uuid4()))
|
||||||
|
|
||||||
|
@testtools.skip('https://bugs.launchpad.net/mistral/+bug/1326284')
|
||||||
|
@test.attr(type='negative')
|
||||||
|
def test_update_nonexistent_task(self):
|
||||||
|
|
||||||
|
id = str(uuid.uuid4())
|
||||||
|
put_body = {
|
||||||
|
"id": id,
|
||||||
|
"state": "ERROR"
|
||||||
|
}
|
||||||
|
|
||||||
|
self.assertRaises(exceptions.NotFound, self.client.update_task,
|
||||||
|
'test123', self.execution['id'], str(uuid.uuid4()),
|
||||||
|
put_body)
|
||||||
|
Loading…
Reference in New Issue
Block a user