mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Added a mocked test case for --timeout
passing to pip install
.
This commit is contained in:
parent
c582d721d9
commit
3372034c07
@ -241,6 +241,37 @@ class PipTestCase(TestCase):
|
|||||||
log='/tmp/pip-install.log'
|
log='/tmp/pip-install.log'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_timeout_argument_in_resulting_command(self):
|
||||||
|
# Passing an int
|
||||||
|
mock = MagicMock(return_value={'retcode': 0, 'stdout': ''})
|
||||||
|
with patch.dict(pip.__salt__, {'cmd.run_all': mock}):
|
||||||
|
pip.install('pep8', timeout=10)
|
||||||
|
mock.assert_called_once_with(
|
||||||
|
'pip install --timeout=10 pep8',
|
||||||
|
runas=None,
|
||||||
|
cwd=None
|
||||||
|
)
|
||||||
|
|
||||||
|
# Passing an int as a string
|
||||||
|
mock = MagicMock(return_value={'retcode': 0, 'stdout': ''})
|
||||||
|
with patch.dict(pip.__salt__, {'cmd.run_all': mock}):
|
||||||
|
pip.install('pep8', timeout='10')
|
||||||
|
mock.assert_called_once_with(
|
||||||
|
'pip install --timeout=10 pep8',
|
||||||
|
runas=None,
|
||||||
|
cwd=None
|
||||||
|
)
|
||||||
|
|
||||||
|
# Passing a non-int to timeout
|
||||||
|
mock = MagicMock(return_value={'retcode': 0, 'stdout': ''})
|
||||||
|
with patch.dict(pip.__salt__, {'cmd.run_all': mock}):
|
||||||
|
self.assertRaises(
|
||||||
|
ValueError,
|
||||||
|
pip.install,
|
||||||
|
'pep8',
|
||||||
|
timeout='a'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from integration import run_tests
|
from integration import run_tests
|
||||||
|
Loading…
Reference in New Issue
Block a user