forked from p34709852/monkey
UT: Mock `open()` in PowerShellExploiter tests instead of using `monkeyfs`
This commit is contained in:
parent
8d9aa9890b
commit
4f0e690a7f
|
@ -48,10 +48,7 @@ def powershell_exploiter(monkeypatch):
|
||||||
|
|
||||||
monkeypatch.setattr(powershell, "AuthenticationError", AuthenticationErrorForTests)
|
monkeypatch.setattr(powershell, "AuthenticationError", AuthenticationErrorForTests)
|
||||||
monkeypatch.setattr(powershell, "is_windows_os", lambda: True)
|
monkeypatch.setattr(powershell, "is_windows_os", lambda: True)
|
||||||
# It's regrettable to mock out a private method on the PowerShellExploiter instance object, but
|
monkeypatch.setattr("builtins.open", lambda _, __: MagicMock())
|
||||||
# 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)
|
|
||||||
|
|
||||||
return pe
|
return pe
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue