Fix failing test now that we're raising a CommandExecutionError

Also adds a test to check that the CommandExecutionError is raised
when the filename is not present.
This commit is contained in:
rallytime 2016-11-01 15:51:09 -06:00
parent c6a3476abb
commit e082ff538b

View file

@ -16,6 +16,7 @@ from salttesting.mock import (
)
# Import Salt Libs
from salt.exceptions import CommandExecutionError
from salt.modules import dnsmasq
# Import python libs
@ -85,6 +86,14 @@ class DnsmasqTestCase(TestCase):
with patch.object(os, 'listdir', mock):
self.assertDictEqual(dnsmasq.get_config(), {'conf-dir': 'A'})
def test_parse_dnsmasq_no_file(self):
'''
Tests that a CommandExecutionError is when a filename that doesn't exist is
passed in.
'''
self.assertRaises(CommandExecutionError, dnsmasq._parse_dnamasq, 'filename')
@patch('os.path.isfile', MagicMock(return_value=True))
def test_parse_dnamasq(self):
'''
test for generic function for parsing dnsmasq files including includes.