aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps/reports_collection.py
diff options
context:
space:
mode:
authorMichal Jagiello <michal.jagiello@t-mobile.pl>2020-10-06 09:56:13 +0000
committerMichal Jagiello <michal.jagiello@t-mobile.pl>2020-10-06 10:25:28 +0000
commit84a44a0cf70e2e55a13e4e994836ee074b7039aa (patch)
tree4a5cd2706061e5147381f87874197777448d85ca /src/onaptests/steps/reports_collection.py
parentc166b498dd792bafc22672d56c15abc5714898ab (diff)
Collect steps execution result
Create a decorator to collect step execution result and store them in storage class. Storage class prepare a dictionary with step class name and execution result. Issue-ID: INT-1733 Change-Id: I9c4030a0740085a9acca461c1581683c469ecbcf Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl>
Diffstat (limited to 'src/onaptests/steps/reports_collection.py')
-rw-r--r--src/onaptests/steps/reports_collection.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/onaptests/steps/reports_collection.py b/src/onaptests/steps/reports_collection.py
new file mode 100644
index 0000000..b61b571
--- /dev/null
+++ b/src/onaptests/steps/reports_collection.py
@@ -0,0 +1,35 @@
+from typing import Dict
+
+
+class ReportsCollection:
+ """Collection to store steps execution statuses."""
+
+ def __init__(self) -> None:
+ """Initialize collection."""
+ self._collection: list = []
+
+ def put(self, item: Dict[str, str]) -> None:
+ """Put execution status dictionary.
+
+ Args:
+ item (Dict[str, str]): Step name with status dictionary
+
+ """
+ self._collection.append(item)
+
+ @property
+ def report(self) -> Dict[str, str]:
+ """Get report.
+
+ Build a dictionary with execution statuses.
+
+ Returns:
+ Dict[str, str]: Steps name with status dictionary
+
+ """
+ report: Dict[str, str] = {}
+ for element in self._collection[::-1]:
+ print(element)
+ print(type(element))
+ report.update(element)
+ return report