summaryrefslogtreecommitdiffstats
path: root/result_collection_api/tests/unit/test_project.py
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2016-05-20 18:00:52 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2016-05-20 18:11:04 +0800
commitf03b81b31c2ff407839d3119deaf9024252bdb6f (patch)
tree2f6c41f2eb73b4104f05f9ed3781c675e88910e5 /result_collection_api/tests/unit/test_project.py
parentc28a4ce4ae7fcff3bf1fca65d4bc9ef6e6a1a270 (diff)
add unittests for testcase and refactor testcase related implementation
modification: add unittests for testcase refactor testcase table name in db to testcases refactor response body fix some bugs JIRA:FUNCTEST-254 Change-Id: Ia7c7101fa742af82bfc8c4a3d398a7dad601bca1 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'result_collection_api/tests/unit/test_project.py')
-rw-r--r--result_collection_api/tests/unit/test_project.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/result_collection_api/tests/unit/test_project.py b/result_collection_api/tests/unit/test_project.py
index e793111..6ce21db 100644
--- a/result_collection_api/tests/unit/test_project.py
+++ b/result_collection_api/tests/unit/test_project.py
@@ -66,23 +66,23 @@ class TestProjectGet(TestProjectBase):
class TestProjectUpdate(TestProjectBase):
def test_withoutBody(self):
- code, _ = self.update('noBody')
+ code, _ = self.update(None, 'noBody')
self.assertEqual(code, HTTP_BAD_REQUEST)
def test_notFound(self):
- code, _ = self.update('notFound', self.req_e)
+ code, _ = self.update(self.req_e, 'notFound')
self.assertEqual(code, HTTP_NOT_FOUND)
def test_newNameExist(self):
self.create_d()
self.create_e()
- code, body = self.update(self.req_d.name, self.req_e)
+ code, body = self.update(self.req_e, self.req_d.name)
self.assertEqual(code, HTTP_FORBIDDEN)
self.assertIn("already exists", body)
def test_noUpdate(self):
self.create_d()
- code, body = self.update(self.req_d.name, self.req_d)
+ code, body = self.update(self.req_d, self.req_d.name)
self.assertEqual(code, HTTP_FORBIDDEN)
self.assertIn("Nothing to update", body)
@@ -92,7 +92,7 @@ class TestProjectUpdate(TestProjectBase):
_id = body._id
req = ProjectCreateRequest('newName', 'new description')
- code, body = self.update(self.req_d.name, req)
+ code, body = self.update(req, self.req_d.name)
self.assertEqual(code, HTTP_OK)
self.assertEqual(_id, body._id)
self.assert_body(body, req)
@@ -104,13 +104,17 @@ class TestProjectUpdate(TestProjectBase):
class TestProjectDelete(TestProjectBase):
def test_notFound(self):
- code = self.delete('notFound')
+ code, body = self.delete('notFound')
self.assertEqual(code, HTTP_NOT_FOUND)
def test_success(self):
self.create_d()
- code = self.delete(self.req_d.name)
+ code, body = self.delete(self.req_d.name)
self.assertEqual(code, HTTP_OK)
+ self.assertEqual(body, '')
+
+ code, body = self.get(self.req_d.name)
+ self.assertEqual(code, HTTP_NOT_FOUND)
if __name__ == '__main__':
unittest.main()