@@ -0,0 +1,1162 @@
+# Run the following command to test:%0A#%0A#     (in /usr/local/googkit)%0A#     $ python -m %7Btest_module_name%7D%0A#%0A# See also: http://docs.python.org/3.3/library/unittest.html#command-line-interface%0A#%0A# We cannot use unittest.mock on python 2.x!%0A# Please install the Mock module when you use Python 2.x.%0A#%0A#     $ easy_install -U Mock%0A#%0A# See also: http://www.voidspace.org.uk/python/mock/#installing%0A%0Aimport unittest%0Aimport os%0A%0Atry:%0A    # Python 3.3 or later%0A    import unittest.mock as mock%0Aexcept ImportError:%0A    # Python 2.x or 3.2-%0A    import mock%0A%0A%0AurlretrieveMock = mock.MagicMock()%0A%0Atry:%0A    # Python 2.x%0A    import urllib%0A    #urllib.urlretrieve%0A    urllib.urlretrieve = urlretrieveMock%0Aexcept ImportError:%0A    # Python 3.x or later%0A    import urllib.request%0A    urllib.request.urlretrieve = urlretrieveMock%0A%0A%0Aimport lib.download%0A%0A%0Aclass TestDownload(unittest.TestCase):%0A    # run %7B%7B%7B%0A    def test_run(self):%0A        lib.download.run('https://exmaple.com/example.zip', '/dir1/dir2')%0A%0A        urlretrieveMock.assert_called_once_with('https://exmaple.com/example.zip', '/dir1/dir2')%0A    # %7D%7D%7D%0A%0A%0Aif __name__ == '__main__':%0A    unittest.main()%0A%0A# vim: fdm=marker%0A

Add a test for lib.download