[Kimchi-devel] [PATCH v5 10/10] Debug Report Rename: Update Test Code
Hongliang Wang
hlwang at linux.vnet.ibm.com
Fri Jul 11 09:17:53 UTC 2014
From: Royce Lv <lvroyce at linux.vnet.ibm.com>
Update model tests and mockmodel tests for debug report.
Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
tests/test_model.py | 7 ++++++-
tests/test_rest.py | 6 +++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/tests/test_model.py b/tests/test_model.py
index 89cadaa..2c77514 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -1063,8 +1063,9 @@ class ModelTests(unittest.TestCase):
report_list = inst.debugreports_get_list()
self.assertFalse(reportName in report_list)
try:
+ tmp_name = reportName + "_1"
task = inst.debugreports_create({'name': reportName})
- rollback.prependDefer(inst.debugreport_delete, reportName)
+ rollback.prependDefer(inst.debugreport_delete, tmp_name)
taskid = task['id']
self._wait_task(inst, taskid, timeout)
self.assertEquals('finished',
@@ -1076,6 +1077,10 @@ class ModelTests(unittest.TestCase):
"./run_tests.sh test_model")
report_list = inst.debugreports_get_list()
self.assertTrue(reportName in report_list)
+ name = inst.debugreport_update(reportName, {'name': tmp_name})
+ self.assertEquals(name, tmp_name)
+ report_list = inst.debugreports_get_list()
+ self.assertTrue(tmp_name in report_list)
except OperationFailed, e:
if not 'debugreport tool not found' in e.message:
raise e
diff --git a/tests/test_rest.py b/tests/test_rest.py
index ad8fc72..694d907 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -1621,11 +1621,15 @@ class RestTests(unittest.TestCase):
# make sure the debugreport doesn't exist until the
# the task is finished
self._wait_task(task['id'])
- rollback.prependDefer(self._report_delete, 'report1')
+ rollback.prependDefer(self._report_delete, 'report2')
resp = request(host, ssl_port, '/debugreports/report1')
debugreport = json.loads(resp.read())
self.assertEquals("report1", debugreport['name'])
self.assertEquals(200, resp.status)
+ req = json.dumps({'name': 'report2'})
+ resp = request(host, ssl_port, '/debugreports/report1',
+ req, 'PUT')
+ self.assertEquals(303, resp.status)
def test_debugreport_download(self):
req = json.dumps({'name': 'report1'})
--
1.8.1.4
More information about the Kimchi-devel
mailing list