Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mytestopia committed Feb 8, 2024
1 parent f05ca1c commit 0487481
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions tests/test_gitlab_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
CleanupEvent,
ScenarioFailedEvent,
ScenarioPassedEvent,
ScenarioSkippedEvent,
ScenarioReportedEvent,
ScenarioRunEvent,
StartupEvent,
Expand Down Expand Up @@ -194,10 +193,35 @@ async def test_scenario_passed_with_none_show_path(*, dispatcher: Dispatcher, pr
]


@pytest.mark.usefixtures(gitlab_reporter.__name__)
async def test_scenario_passed_with_specified_show_path_included(*, dispatcher: Dispatcher, printer_: Mock):
with given:
await fire_arg_parsed_event(dispatcher, show_paths=[ScenarioStatus.PASSED.value])

scenario_result = make_scenario_result().mark_passed()
await dispatcher.fire(ScenarioPassedEvent(scenario_result))

aggregated_result = make_aggregated_result(scenario_result)
event = ScenarioReportedEvent(aggregated_result)

with when:
await dispatcher.fire(event)

with then:
assert printer_.mock_calls == [
call.print_scenario_subject(aggregated_result.scenario.subject,
ScenarioStatus.PASSED,
elapsed=aggregated_result.elapsed,
prefix=" "),
call.print_scenario_extra_details([f"{aggregated_result.scenario.path.name}"],
prefix=" " * 3)
]


@pytest.mark.usefixtures(gitlab_reporter.__name__)
async def test_scenario_passed_with_specified_show_path_not_included(*, dispatcher: Dispatcher, printer_: Mock):
with given:
await fire_arg_parsed_event(dispatcher, show_paths=[ScenarioStatus.FAILED])
await fire_arg_parsed_event(dispatcher, show_paths=[ScenarioStatus.FAILED.value])

scenario_result = make_scenario_result().mark_passed()
await dispatcher.fire(ScenarioPassedEvent(scenario_result))
Expand Down

0 comments on commit 0487481

Please sign in to comment.