Esempio n. 1
0
 def test_command_injection_exit(fixture_tmpdir):
     """test that subprocess.run isn't raising an exception due to exit 1"""
     mocked_self = mock.MagicMock()
     mocked_self._gitcmd = Gitget._gitcmd
     mocked_self._repodir = fixture_tmpdir
     # must not raise an exception
     Gitget._run_command(mocked_self, ("--version", ";", "exit", "1"))
Esempio n. 2
0
 def test_command_injection_output(fixture_tmpdir):
     """test that subprocess.run output doesn't contain output from injected command"""
     mocked_self = mock.MagicMock()
     mocked_self._gitcmd = Gitget._gitcmd
     mocked_self._repodir = fixture_tmpdir
     output = Gitget._run_command(mocked_self, ("--version", ";", "pwd"))
     assert mocked_self._repodir not in output
Esempio n. 3
0
 def test_shell_false(mocker):
     """test that subprocess.run is using shell=False"""
     mocked_run = mocker.patch("as3ninja.gitget.run")
     Gitget._run_command(mock.MagicMock(), ("ls"))
     assert "shell=False" in str(mocked_run.call_args)