From 90bf67cf56a6ad6ac666cacd1f5ce0acd1fc47e3 Mon Sep 17 00:00:00 2001 From: Stephen Fromm Date: Sun, 29 Jul 2012 22:40:12 -0700 Subject: [PATCH] Make test_git functional in TestRunner.py --- test/TestRunner.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/test/TestRunner.py b/test/TestRunner.py index ed429683ed6..aa7d82734b1 100644 --- a/test/TestRunner.py +++ b/test/TestRunner.py @@ -9,6 +9,7 @@ import ansible.runner import os import shutil import time +import tempfile try: import json except: @@ -188,8 +189,22 @@ class TestRunner(unittest.TestCase): assert 'failed' not in result def test_git(self): - # TODO: tests for the git module - pass + if not get_binary("yum"): + raise SkipTest + repo = 'git://github.com/ansible/ansible.git' + dest = tempfile.mkdtemp() + result = self._run('git', ['repo=%s' % repo, 'dest=%s' % dest]) + assert 'failed' not in result + result = self._run('git', [ + 'repo=%s' % repo, + 'dest=%s' % dest, + 'version=master' + ]) + assert 'false' not in result + try: + shutil.rmtree(dest) + except OSError, e: + print "Failed to remove temp dir %s" % dest def test_service(self): # TODO: tests for the service module