Add basic test of yum module (VERY basic) just to make sure syntax remains ok. Need to do something

trivial for service and git module also.
This commit is contained in:
Michael DeHaan 2012-03-14 20:02:29 -04:00
commit 73d20b81c6

View file

@ -159,18 +159,14 @@ class TestRunner(unittest.TestCase):
def test_async(self): def test_async(self):
# test async launch and job status # test async launch and job status
# of any particular module # of any particular module
print "firing command..."
result = self._run('command', [ "/bin/sleep", "3" ], background=20) result = self._run('command', [ "/bin/sleep", "3" ], background=20)
print "back..."
assert 'ansible_job_id' in result assert 'ansible_job_id' in result
assert 'started' in result assert 'started' in result
jid = result['ansible_job_id'] jid = result['ansible_job_id']
# no real chance of this op taking a while, but whatever # no real chance of this op taking a while, but whatever
time.sleep(5) time.sleep(5)
# CLI will abstract this, but this is how it works internally # CLI will abstract this (when polling), but this is how it works internally
print "checking status..."
result = self._run('async_status', [ "jid=%s" % jid ]) result = self._run('async_status', [ "jid=%s" % jid ])
print "back..."
# TODO: would be nice to have tests for supervisory process # TODO: would be nice to have tests for supervisory process
# killing job after X seconds # killing job after X seconds
assert 'finished' in result assert 'finished' in result
@ -179,6 +175,10 @@ class TestRunner(unittest.TestCase):
assert 'stdout' in result assert 'stdout' in result
assert result['ansible_job_id'] == jid assert result['ansible_job_id'] == jid
def test_yum(self):
result = self._run('yum', [ "list=repos" ])
assert 'failed' not in result
def test_git(self): def test_git(self):
# TODO: tests for the git module # TODO: tests for the git module
pass pass