From fc92864e54ea3b9f557e3a1506db43ced3d4ae7c Mon Sep 17 00:00:00 2001 From: Masayuki Igawa Date: Thu, 26 Mar 2015 09:42:17 -0400 Subject: Add unit tests for __str__ method of ResponseBody* classes This commit adds unit tests for __str__ method of Responsebody* classes. Change-Id: Iaefce08eb6481da6e0f6f47b2ec863c391f232c4 --- tempest_lib/tests/test_rest_client.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) 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)) -- cgit v1.2.1