Skip to content

Commit

Permalink
* PT019
Browse files Browse the repository at this point in the history
  • Loading branch information
bandophahita committed Jan 15, 2024
1 parent 51994fe commit 3db6366
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions tests/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,19 +1029,16 @@ def test_perform_save_console_log_writes_log(
file_descriptor = mocked_open()
file_descriptor.write.assert_called_once_with("\n".join(test_log))

@mock.patch("builtins.open", new_callable=mock.mock_open)
@mock.patch(
"screenpy_selenium.actions.save_console_log.AttachTheFile", autospec=True
)
def test_sends_kwargs_to_attach(
self, mocked_atf: mock.Mock, _: mock.Mock, Tester: Actor
) -> None:
def test_sends_kwargs_to_attach(self, mocked_atf: mock.Mock, Tester: Actor) -> None:
test_path = "doppelganger.png"
test_kwargs = {"name": "Mystique"}
browser = get_mocked_browser(Tester)
browser.get_log.return_value = [1, 2, 3]

SaveConsoleLog(test_path).and_attach_it(**test_kwargs).perform_as(Tester)
with mock.patch("builtins.open", new_callable=mock.mock_open):
SaveConsoleLog(test_path).and_attach_it(**test_kwargs).perform_as(Tester)

mocked_atf.assert_called_once_with(test_path, **test_kwargs)

Expand Down Expand Up @@ -1095,17 +1092,17 @@ def test_perform_calls_open_with_path(

mocked_open.assert_called_once_with(test_path, "wb+")

@mock.patch("builtins.open", new_callable=mock.mock_open)
@mock.patch(
"screenpy_selenium.actions.save_screenshot.AttachTheFile", autospec=True
)
def test_perform_sends_kwargs_to_attach(
self, mocked_atf: mock.Mock, _: mock.Mock, Tester: Actor
self, mocked_atf: mock.Mock, Tester: Actor
) -> None:
test_path = "souiiie.png"
test_kwargs = {"color": "Red", "weather": "Tornado"}

SaveScreenshot(test_path).and_attach_it(**test_kwargs).perform_as(Tester)
with mock.patch("builtins.open", new_callable=mock.mock_open):
SaveScreenshot(test_path).and_attach_it(**test_kwargs).perform_as(Tester)

mocked_atf.assert_called_once_with(test_path, **test_kwargs)

Expand Down

0 comments on commit 3db6366

Please sign in to comment.