Add a new exception for invalid structure
This commit fixes too broad exception in output_parser. Otherwise, we
can't assert the Exception in unit tests.
Partially implements bp unit-tests
Change-Id: I9e45571dbf964a37dd9d0249a6f662216d5d046c
diff --git a/tempest/cli/output_parser.py b/tempest/cli/output_parser.py
index 4edcd47..80234a3 100644
--- a/tempest/cli/output_parser.py
+++ b/tempest/cli/output_parser.py
@@ -17,6 +17,7 @@
import re
+from tempest import exceptions
from tempest.openstack.common import log as logging
@@ -37,7 +38,7 @@
for table_ in tables_:
if 'Property' not in table_['headers'] \
or 'Value' not in table_['headers']:
- raise Exception('Invalid structure of table with details')
+ raise exceptions.InvalidStructure()
item = {}
for value in table_['values']:
item[value[0]] = value[1]
diff --git a/tempest/exceptions/__init__.py b/tempest/exceptions/__init__.py
index 485f532..d313def 100644
--- a/tempest/exceptions/__init__.py
+++ b/tempest/exceptions/__init__.py
@@ -158,3 +158,7 @@
class UnexpectedResponseCode(base.RestClientException):
message = "Unexpected response code received"
+
+
+class InvalidStructure(base.TempestException):
+ message = "Invalid structure of table with details"