UT: Mock `open()` in PowerShellExploiter tests instead of using `monkeyfs`

This commit is contained in:
Shreya Malviya 2022-03-14 16:37:24 +05:30 committed by Ilija Lazoroski
parent 8d9aa9890b
commit 4f0e690a7f
1 changed files with 1 additions and 4 deletions

View File

@ -48,10 +48,7 @@ def powershell_exploiter(monkeypatch):
monkeypatch.setattr(powershell, "AuthenticationError", AuthenticationErrorForTests)
monkeypatch.setattr(powershell, "is_windows_os", lambda: True)
# It's regrettable to mock out a private method on the PowerShellExploiter instance object, but
# it's necessary to avoid having to deal with the monkeyfs. TODO: monkeyfs has been removed, so
# fix this.
# monkeypatch.setattr(pe, "_create_local_agent_file", lambda: None)
monkeypatch.setattr("builtins.open", lambda _, __: MagicMock())
return pe