blob: e0c8b6b505f3a5574692866f0c3c7ddcf9e0591d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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"}
|