aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_store_state.py
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2020-10-07 09:02:51 +0000
committerGerrit Code Review <gerrit@onap.org>2020-10-07 09:02:51 +0000
commitd1d44781c7d03c8794dd626184f77d9836264212 (patch)
treec4fd34da2631a3a775612946841bd7149b664f8c /tests/test_store_state.py
parent9cd3c4fef7b7e980321486bfd1a86366a2221a16 (diff)
parent84a44a0cf70e2e55a13e4e994836ee074b7039aa (diff)
Merge "Collect steps execution result"
Diffstat (limited to 'tests/test_store_state.py')
-rw-r--r--tests/test_store_state.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_store_state.py b/tests/test_store_state.py
new file mode 100644
index 0000000..e0c8b6b
--- /dev/null
+++ b/tests/test_store_state.py
@@ -0,0 +1,29 @@
+import pytest
+from onaptests.steps.base import BaseStep
+
+
+class TestStep(BaseStep):
+
+ @BaseStep.store_state
+ def execute(self):
+ return super().execute()
+
+
+class TestFailStep(BaseStep):
+
+ @BaseStep.store_state
+ def execute(self):
+ super().execute()
+ raise Exception
+
+
+def test_store_state():
+ ts = TestStep()
+ ts.execute()
+ assert ts.reports_collection.report == {"TestStep": "PASS"}
+
+ fs = TestFailStep()
+ fs.add_step(TestStep())
+ with pytest.raises(Exception):
+ fs.execute()
+ fs.reports_collection.report == {"TestFailStep": "FAIL", "TestStep": "PASS"}