mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Update pdbedit tests to handle debian versions
Debian seems to prepend `-Debian` behind the version, we should test those too. Also lower the requirement to 4.5.0 as apparently that version is new enough according to https://github.com/saltstack/salt/issues/55185#issuecomment-625285808
This commit is contained in:
parent
d8314b5897
commit
2065fa15f0
1 changed files with 12 additions and 4 deletions
|
@ -26,8 +26,9 @@ class PdbeditTestCase(TestCase, LoaderModuleMockMixin):
|
|||
"""
|
||||
mock_bad_ver = MagicMock(return_value="Ver 1.1a")
|
||||
mock_old_ver = MagicMock(return_value="Version 1.0.0")
|
||||
mock_exa_ver = MagicMock(return_value="Version 4.8.0")
|
||||
mock_exa_ver = MagicMock(return_value="Version 4.5.0")
|
||||
mock_new_ver = MagicMock(return_value="Version 4.9.2")
|
||||
mock_deb_ver = MagicMock(return_value="Version 4.5.16-Debian")
|
||||
|
||||
# NOTE: no pdbedit installed
|
||||
with patch("salt.utils.path.which", MagicMock(return_value=None)):
|
||||
|
@ -49,17 +50,24 @@ class PdbeditTestCase(TestCase, LoaderModuleMockMixin):
|
|||
), patch("salt.modules.cmdmod.run", mock_old_ver):
|
||||
ret = pdbedit.__virtual__()
|
||||
self.assertEqual(
|
||||
ret, (False, "pdbedit is to old, 4.8.0 or newer is required")
|
||||
ret, (False, "pdbedit is to old, 4.5.0 or newer is required")
|
||||
)
|
||||
|
||||
# NOTE: pdbedit is exactly 4.8.0
|
||||
# NOTE: pdbedit is exactly 4.5.0
|
||||
with patch(
|
||||
"salt.utils.path.which", MagicMock(return_value="/opt/local/bin/pdbedit")
|
||||
), patch("salt.modules.cmdmod.run", mock_exa_ver):
|
||||
ret = pdbedit.__virtual__()
|
||||
self.assertEqual(ret, "pdbedit")
|
||||
|
||||
# NOTE: pdbedit is newer than 4.8.0
|
||||
# NOTE: pdbedit is debian version
|
||||
with patch(
|
||||
"salt.utils.path.which", MagicMock(return_value="/opt/local/bin/pdbedit")
|
||||
), patch("salt.modules.cmdmod.run", mock_deb_ver):
|
||||
ret = pdbedit.__virtual__()
|
||||
self.assertEqual(ret, "pdbedit")
|
||||
|
||||
# NOTE: pdbedit is newer than 4.5.0
|
||||
with patch(
|
||||
"salt.utils.path.which", MagicMock(return_value="/opt/local/bin/pdbedit")
|
||||
), patch("salt.modules.cmdmod.run", mock_new_ver):
|
||||
|
|
Loading…
Add table
Reference in a new issue