11from functools import partial
22from hamcrest import assert_that
3+ from hamcrest import not_
34from allure_commons_test .report import has_test_case
45from allure_commons_test .result import with_status
56from allure_commons_test .result import has_step
67from allure_commons_test .result import has_attachment
78from allure_commons_test .result import has_parameter
89from allure_commons_test .container import has_container
9- from allure_commons_test .container import has_before
10+ from allure_commons_test .container import has_before , has_after
1011from allure_commons_test .label import has_severity
1112from allure_commons_test .label import has_tag
1213
@@ -22,24 +23,49 @@ def match(matcher, *args):
2223
2324
2425@then (u'allure report has a scenario with name "{scenario}"' )
25- def step_impl (context , scenario ):
26+ def step_scenario (context , scenario ):
2627 matcher = partial (match , has_test_case , scenario )
2728 context .scenario = matcher
2829 assert_that (context .allure_report , matcher ())
2930
3031
31- @then (u'scenario has background "{background }"' )
32- @then (u'this scenario has background "{background }"' )
33- def step_impl (context , background ):
32+ @then (u'scenario has before fixture "{fixture }"' )
33+ @then (u'this scenario has before fixture "{fixture }"' )
34+ def step_before_fixture (context , fixture ):
3435 context_matcher = context .scenario
35- matcher = partial (context_matcher , has_container , context .allure_report , has_before , background )
36- context .background = matcher
36+ matcher = partial (context_matcher , has_container , context .allure_report , has_before , fixture )
37+ context .before = matcher
38+ assert_that (context .allure_report , matcher ())
39+
40+
41+ @then (u'scenario has after fixture "{fixture}"' )
42+ @then (u'this scenario has after fixture "{fixture}"' )
43+ def step_after_fixture (context , fixture ):
44+ context_matcher = context .scenario
45+ matcher = partial (context_matcher , has_container , context .allure_report , has_after , fixture )
46+ context .after = matcher
47+ assert_that (context .allure_report , matcher ())
48+
49+
50+ @then (u'scenario has not before fixture "{fixture}"' )
51+ @then (u'this scenario has not before fixture "{fixture}"' )
52+ def step_no_before_fixture (context , fixture ):
53+ context_matcher = context .scenario
54+ matcher = partial (context_matcher , not_ , has_container , context .allure_report , has_before , fixture )
55+ assert_that (context .allure_report , matcher ())
56+
57+
58+ @then (u'scenario has not after fixture "{fixture}"' )
59+ @then (u'this scenario has not after fixture "{fixture}"' )
60+ def step_impl (context , fixture ):
61+ context_matcher = context .scenario
62+ matcher = partial (context_matcher , not_ , has_container , context .allure_report , has_after , fixture )
3763 assert_that (context .allure_report , matcher ())
3864
3965
4066@then (u'{item} contains step "{step}"' )
4167@then (u'this {item} contains step "{step}"' )
42- def step_impl (context , item , step ):
68+ def step_step (context , item , step ):
4369 context_matcher = getattr (context , item )
4470 matcher = partial (context_matcher , has_step , step )
4571 context .step = matcher
@@ -48,39 +74,39 @@ def step_impl(context, item, step):
4874
4975@then (u'{item} has "{status}" status' )
5076@then (u'this {item} has "{status}" status' )
51- def step_impl (context , item , status ):
77+ def step_status (context , item , status ):
5278 context_matcher = getattr (context , item )
5379 matcher = partial (context_matcher , with_status , status )
5480 assert_that (context .allure_report , matcher ())
5581
5682
5783@then (u'scenario has "{severity}" severity' )
5884@then (u'this scenario has "{severity}" severity' )
59- def step_impl (context , severity ):
85+ def step_severity (context , severity ):
6086 context_matcher = context .scenario
6187 matcher = partial (context_matcher , has_severity , severity )
6288 assert_that (context .allure_report , matcher ())
6389
6490
6591@then (u'scenario has "{tag}" tag' )
6692@then (u'this scenario has "{tag}" tag' )
67- def step_impl (context , tag ):
93+ def step_tag (context , tag ):
6894 context_matcher = context .scenario
6995 matcher = partial (context_matcher , has_tag , tag )
7096 assert_that (context .allure_report , matcher ())
7197
7298
7399@then (u'{item} has parameter "{name}" with value "{value}"' )
74100@then (u'this {item} has parameter "{name}" with value "{value}"' )
75- def step_impl (context , item , name , value ):
101+ def step_parameter (context , item , name , value ):
76102 context_matcher = getattr (context , item )
77103 matcher = partial (context_matcher , has_parameter , name , value )
78104 assert_that (context .allure_report , matcher ())
79105
80106
81107@then (u'{item} has attachment' )
82108@then (u'this {item} has attachment' )
83- def step_impl (context , item ):
109+ def step_attachment (context , item ):
84110 context_matcher = getattr (context , item )
85111 matcher = partial (context_matcher , has_attachment )
86112 assert_that (context .allure_report , matcher ())
0 commit comments