Initial host state test

This commit is contained in:
Thomas S Hatch 2012-05-14 23:56:45 -06:00
parent 26bcb2a4cf
commit 5f9a7e87e4

View File

@ -0,0 +1,28 @@
'''
tests for host state
'''
# Import python libs
import os
#
# Import salt libs
from saltunittest import TestLoader, TextTestRunner
import integration
from integration import TestDaemon
HFILE = os.path.join(integration.TMP, 'hosts')
class HostTest(integration.ModuleCase):
'''
Validate the host state
'''
def test_present(self):
'''
host.present
'''
ret = self.run_state('host.present', name='spam.bacon', ip='10.10.10.10')
result = self.state_result(ret)
self.assertTrue(result)
with open(HFILE) as fp_:
self.assertIn('{0}\t\t{1}'.format(ip, name), fp_.read())