diff options
author | Masayuki Igawa <mas-igawa@ut.jp.nec.com> | 2015-03-26 09:42:17 -0400 |
---|---|---|
committer | Masayuki Igawa <mas-igawa@ut.jp.nec.com> | 2015-03-26 15:53:29 -0400 |
commit | fc92864e54ea3b9f557e3a1506db43ced3d4ae7c (patch) | |
tree | cd69acf24083b16fea693401f11822f646875092 | |
parent | 70bbbd5ecdd27e8d680e0c9dbb0930a4eee81c9d (diff) | |
download | tempest-lib-fc92864e54ea3b9f557e3a1506db43ced3d4ae7c.tar.gz |
Add unit tests for __str__ method of ResponseBody* classes
This commit adds unit tests for __str__ method of Responsebody* classes.
Change-Id: Iaefce08eb6481da6e0f6f47b2ec863c391f232c4
-rw-r--r-- | tempest_lib/tests/test_rest_client.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tempest_lib/tests/test_rest_client.py b/tempest_lib/tests/test_rest_client.py index b48c156..d585b88 100644 --- a/tempest_lib/tests/test_rest_client.py +++ b/tempest_lib/tests/test_rest_client.py @@ -483,3 +483,33 @@ class TestExpectedSuccess(BaseRestClientTestClass): read_code = 202 self.assertRaises(AssertionError, self.rest_client.expected_success, expected_code, read_code) + + +class TestResponseBody(base.TestCase): + + def test_str(self): + response = {'status': 200} + body = {'key1': 'value1'} + actual = rest_client.ResponseBody(response, body) + self.assertEqual("response: %s\nBody: %s" % (response, body), + str(actual)) + + +class TestResponseBodyData(base.TestCase): + + def test_str(self): + response = {'status': 200} + data = 'data1' + actual = rest_client.ResponseBodyData(response, data) + self.assertEqual("response: %s\nBody: %s" % (response, data), + str(actual)) + + +class TestResponseBodyList(base.TestCase): + + def test_str(self): + response = {'status': 200} + body = ['value1', 'value2', 'value3'] + actual = rest_client.ResponseBodyList(response, body) + self.assertEqual("response: %s\nBody: %s" % (response, body), + str(actual)) |