Add test case to reproduce dnsmasq.set_config failure in #34263

This commit is contained in:
rallytime 2016-11-01 14:16:07 -06:00
parent 1a4833b3a1
commit fd380c79b9

View file

@ -58,6 +58,23 @@ class DnsmasqTestCase(TestCase):
with patch.object(os, 'listdir', mock):
self.assertDictEqual(dnsmasq.set_config(), {})
@patch('salt.modules.dnsmasq.get_config', MagicMock(return_value={'conf-dir': 'A'}))
def test_set_config_filter_pub_kwargs(self):
'''
Test that the kwargs returned from running the set_config function
do not contain the __pub that may have been passed through in **kwargs.
'''
mock_domain = 'local'
mock_address = '/some-test-address.local/8.8.4.4'
with patch.dict(dnsmasq.__salt__, {'file.append': MagicMock()}):
ret = dnsmasq.set_config(follow=False,
domain=mock_domain,
address=mock_address,
__pub_pid=8184,
__pub_jid=20161101194639387946,
__pub_tgt='salt-call')
self.assertEqual(ret, {'domain': mock_domain, 'address': mock_address})
def test_get_config(self):
'''
test to dumps all options from the config file.