mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Mock open to /var/log/btmp and /var/log/wtmp
- btmp may not exist - wtmp may not exist, or it may not contain ASCII data Unbreaks tests on OpenBSD 6.2
This commit is contained in:
parent
19a5383c59
commit
10d13062ec
2 changed files with 8 additions and 4 deletions
|
@ -59,8 +59,10 @@ class BTMPBeaconTestCase(TestCase, LoaderModuleMockMixin):
|
|||
|
||||
self.assertEqual(ret, (True, 'Valid beacon configuration'))
|
||||
|
||||
ret = btmp.beacon(config)
|
||||
self.assertEqual(ret, [])
|
||||
with patch('salt.utils.files.fopen', mock_open()) as m_open:
|
||||
ret = btmp.beacon(config)
|
||||
m_open.assert_called_with(btmp.BTMP, 'rb')
|
||||
self.assertEqual(ret, [])
|
||||
|
||||
def test_match(self):
|
||||
with patch('salt.utils.files.fopen',
|
||||
|
|
|
@ -60,8 +60,10 @@ class WTMPBeaconTestCase(TestCase, LoaderModuleMockMixin):
|
|||
|
||||
self.assertEqual(ret, (True, 'Valid beacon configuration'))
|
||||
|
||||
ret = wtmp.beacon(config)
|
||||
self.assertEqual(ret, [])
|
||||
with patch('salt.utils.files.fopen', mock_open()) as m_open:
|
||||
ret = wtmp.beacon(config)
|
||||
m_open.assert_called_with(wtmp.WTMP, 'rb')
|
||||
self.assertEqual(ret, [])
|
||||
|
||||
def test_match(self):
|
||||
with patch('salt.utils.files.fopen',
|
||||
|
|
Loading…
Add table
Reference in a new issue