#! /usr/bin/env python
# py lint: skip-file
#
# downloader_test.py
#
# Copyright (c) 2015-2016 Junpei Kawamoto
#
# This software is released under the MIT License.
#
# http://opensource.org/licenses/mit-license.php
#
""" Test for source method.
"""
import logging
import tempfile
import os.path
import shutil
import sys
import unittest
from roadie import source  # pylint: disable=import-error


REPO_SSH = "git@github.com:jkawamoto/roadie-gcp.git"
REPO_HTTPS = "https://github.com/jkawamoto/roadie-gcp.git"
CHECK_FILE = "README.md"


class TestSource(unittest.TestCase):
    """ Test case for source method.

    Skip testing of `url` sectiong because it is depened on download module and
    we have other tests for the module.
    """

    def setUp(self):
        """ Create a temporal directory.
        """
        self.dir = tempfile.mkdtemp(dir=".")

    def tearDown(self):
        """ Remove the temporal directory setUp made.
        """
        shutil.rmtree(self.dir)

    def test_clone_via_ssh(self):
        """ Test downloading a file.
        """
        source(dict(git=REPO_SSH), self.dir)
        with open(os.path.join(self.dir, CHECK_FILE)) as res:
            with open(CHECK_FILE) as ans:
                self.assertEqual(res.read(), ans.read())

    def test_clone_via_https(self):
        """ Test downloading a file.
        """
        source(dict(git=REPO_HTTPS), self.dir)
        with open(os.path.join(self.dir, CHECK_FILE)) as res:
            with open(CHECK_FILE) as ans:
                self.assertEqual(res.read(), ans.read())


if __name__ == "__main__":
    logging.basicConfig(level=logging.INFO, stream=sys.stderr)
    unittest.main()

@@ -273,16 +273,26 @@
 empfile%0A
+import os%0A
 import o
@@ -537,16 +537,40 @@
 ME.md%22%0A%0A
+_SSH_TEST = %22SSH_TEST%22%0A%0A
 %0Aclass T
@@ -1009,16 +1009,156 @@
 f.dir)%0A%0A
+    @unittest.skipUnless(%0A        _SSH_TEST in os.environ and bool(os.environ%5B_SSH_TEST%5D),%0A        %22This test requires to deploy ssh key.%22)%0A
     def 

Update tests so that they skip tests using ssh key if such key is not supplied.