mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix mock emulating lvm version
'lvm version' produces multiline output whereas test_version and test_fullversion use mocks with single-line output. Use real-life 'lvm version' output in those mocks instead.
This commit is contained in:
parent
92a542fa21
commit
fb7ef99838
1 changed files with 15 additions and 4 deletions
|
@ -34,18 +34,29 @@ class LinuxLVMTestCase(TestCase):
|
|||
'''
|
||||
Tests LVM version info from lvm version
|
||||
'''
|
||||
mock = MagicMock(return_value='Library version : 1')
|
||||
mock = MagicMock(return_value=
|
||||
' LVM version: 2.02.168(2) (2016-11-30)\n'
|
||||
' Library version: 1.03.01 (2016-11-30)\n'
|
||||
' Driver version: 4.35.0\n'
|
||||
)
|
||||
with patch.dict(linux_lvm.__salt__, {'cmd.run': mock}):
|
||||
self.assertEqual(linux_lvm.version(), '1')
|
||||
self.assertEqual(linux_lvm.version(), '2.02.168(2) (2016-11-30)')
|
||||
|
||||
def test_fullversion(self):
|
||||
'''
|
||||
Tests all version info from lvm version
|
||||
'''
|
||||
mock = MagicMock(return_value='Library version : 1')
|
||||
mock = MagicMock(return_value=
|
||||
' LVM version: 2.02.168(2) (2016-11-30)\n'
|
||||
' Library version: 1.03.01 (2016-11-30)\n'
|
||||
' Driver version: 4.35.0\n'
|
||||
)
|
||||
with patch.dict(linux_lvm.__salt__, {'cmd.run': mock}):
|
||||
self.assertDictEqual(linux_lvm.fullversion(),
|
||||
{'Library version': '1'})
|
||||
{'LVM version': '2.02.168(2) (2016-11-30)',
|
||||
'Library version': '1.03.01 (2016-11-30)',
|
||||
'Driver version': '4.35.0',
|
||||
})
|
||||
|
||||
def test_pvdisplay(self):
|
||||
'''
|
||||
|
|
Loading…
Add table
Reference in a new issue