def test_simple_parse(self): result = db_to_call_list( tempest_log.parse_logfile(StringIO(SIMPLE_LOG))) self.assertEqual(result, [ ({'url': '/v2.0/tokens', 'service': 'identity', 'headers': {}, 'body': None, 'method': 'POST'}, {'status_code': '200', 'body': None, 'headers': {'status': '200', 'content-length': '0', 'date': 'Sun, 13 Sep 2015 07:43:01 GMT', 'content-type': 'application/json', 'x-openstack-request-id': 'req-1', 'vary': 'X-Auth-Token', 'connection': 'close', 'server': 'Apache/2.4.7 (Ubuntu)'}}), ({'url': '/v2.0/tokens', 'service': 'identity', 'headers': {}, 'body': None, 'method': 'POST'}, {'status_code': '200', 'body': None, 'headers': {'status': '200', 'content-length': '0', 'date': 'Sun, 13 Sep 2015 07:43:01 GMT', 'content-type': 'application/json', 'x-openstack-request-id': 'req-2', 'vary': 'X-Auth-Token', 'connection': 'close', 'server': 'Apache/2.4.7 (Ubuntu)'}})])
def test_debug_log(self): result = db_to_call_list( tempest_log.parse_logfile(StringIO(DEBUG_LOG))) self.assertEqual(result, [ ({'body': None, 'headers': {'accept': 'application/json', 'content-type': 'application/json', 'content-length': '0', 'x-auth-token': '<omitted>'}, 'method': 'DELETE', 'service': 'application-catalog', 'url': '/v1/environments/c32c6d5095c4476da549ed065e9b5196'}, {'body': None, 'headers': {'connection': 'close', 'content-length': '0', 'content-type': 'application/json', 'date': 'Fri, 04 Sep 2015 15:52:13 GMT', 'status': '200', 'x-openstack-request-id': 'req-0ff36a16-dacd-49c8-9835-7ce92d50f5a7'}, 'status_code': '200'}), ({'body': None, 'headers': {'accept': 'application/json', 'content-type': 'application/json', 'content-length': '0', 'x-auth-token': '<omitted>'}, 'method': 'DELETE', 'service': 'application-catalog', 'url': '/v1/environments/7501923609b145ec88eeb4a5c93e371c' '/sessions/db214e36e0494c4e9dc67fb0df8548f7'}, {'body': '403 Forbidden\n' 'User is not authorized to access these tenant resources\n\n', 'headers': {'connection': 'close', 'content-length': '13', 'content-type': 'text/plain; charset=UTF-8', 'date': 'Fri, 04 Sep 2015 15:54:42 GMT', 'status': '403', 'x-openstack-request-id': 'req-39c6042e-5a4a-4517-9fe9-32b34cfaa5a8'}, 'status_code': '403'})])
def test_debug_admin_log(self): result = db_to_call_list( tempest_log.parse_logfile(StringIO(DEBUG_LOG_AUTH))) self.assertEqual(result, [ ({'body': None, 'headers': {}, 'method': 'POST', 'service': 'identity', 'url': '/v2.0/tokens'}, {'body': None, 'headers': {'connection': 'close', 'content-length': '0', 'content-type': 'application/json', 'date': 'Fri, 04 Sep 2015 15:49:42 GMT', 'server': 'Apache/2.4.7 (Ubuntu)', 'status': '200', 'vary': 'X-Auth-Token', 'x-openstack-request-id': 'req-280bc347-e650-473e-92bb-bcc59103e12c'}, 'status_code': '200'})])
def test_body_parse(self): result = db_to_call_list( tempest_log.parse_logfile(StringIO(SIMPLE_LOG_BODY))) self.assertEqual(result, [ ({'url': '/v2.1/6b45254f6f7c44a1b65ddb8218932226/flavors/1', 'headers': {'content-type': 'application/json', 'content-length': '0', 'accept': 'application/json', 'x-auth-token': '<omitted>'}, 'body': None, 'method': 'GET', 'service': 'compute'}, {'body': '{\n "flavor": {\n "OS-FLV-DISABLED:disabled": false,\n "OS-FLV-EXT-DATA:ephemeral": 0,\n "disk": 1,\n "id": "1",\n "links": [\n {\n "href": "http://192.168.122.201:8774/v2.1/6b45254f6f7c44a1b65ddb8218932226/flavors/1",\n "rel": "self"\n },\n {\n "href": "http://192.168.122.201:8774/6b45254f6f7c44a1b65ddb8218932226/flavors/1",\n "rel": "bookmark"\n }\n ],\n "name": "m1.tiny",\n "os-flavor-access:is_public": true,\n "ram": 512,\n "rxtx_factor": 1.0,\n "swap": "",\n "vcpus": 1\n }\n}', # noqa 'status_code': '200', 'headers': {'status': '200', 'content-length': '548', 'content-location': 'http://192.168.122.201:8774/v2.1/6b45254f6f7c44a1b65ddb8218932226/flavors/1', # noqa 'x-openstack-nova-api-version': '2.1', 'date': 'Sun, 13 Sep 2015 07:43:01 GMT', 'vary': 'X-OpenStack-Nova-API-Version', 'x-compute-request-id': 'req-959a09e8-3628-419d-964a-1be4ca604232', # noqa 'content-type': 'application/json', 'connection': 'close'}})])