# Path: test/stub_config.py
# class StubConfig(object):
#     def __init__(self):
#         pass
# 
#     def development_dir(self):
#         return StubConfig.DEVELOPMENT_DIR
# 
#     def debug_dir(self):
#         return StubConfig.DEBUG_DIR
# 
#     def production_dir(self):
#         return StubConfig.PRODUCTION_DIR
# 
#     def compiled_js_ext(self):
#         return StubConfig.COMPILED_JS_EXT
# 
#     def test_file_pattern(self):
#         return StubConfig.TEST_FILE_PATTERN
# 
#     def library_root(self):
#         return StubConfig.LIBRARRY_ROOT
# 
#     def closurebuilder(self):
#         return StubConfig.CLOSUREBUILDER
# 
#     def depswriter(self):
#         return StubConfig.DEPSWRITER
# 
#     def compiler_root(self):
#         return StubConfig.COMPILER_ROOT
# 
#     def base_js(self):
#         return StubConfig.BASE_JS
# 
#     def multitestrunner_css(self):
#         return StubConfig.MULTI_TEST_RUNNER_CSS
# 
#     def js_dev_dir(self):
#         return StubConfig.JS_DEV_DIR
# 
#     def deps_js(self):
#         return StubConfig.DEPS_JS
# 
#     def testrunner(self):
#         return StubConfig.TESTRUNNER
# 
#     def compiler(self):
#         return StubConfig.COMPILER
# 
#     def compilation_level(self):
#         return StubConfig.COMPILATION_LEVEL
# 
#     def compiler_zip(self):
#         return StubConfig.COMPILER_LATEST_ZIP
# 
#     def library_repos(self):
#         return StubConfig.LIBRARY_GIT_REPOS
# 
#     def compiler_flagfile(self):
#         return StubConfig.COMPILER_FLAGFILE
# 
#     def compiler_flagfile_for_debug(self):
#         return StubConfig.COMPILER_FLAGFILE_FOR_DEBUG
# 
#     def linter_flagfile(self):
#         return StubConfig.LINTER_FLAGFILE
# 
# Path: test/stub_environment.py
# class StubEnvironment(object):
#     def __init__(self):
#         self.cwd = None
#         self.tree = None
#         self.argument = None
# 
# Path: test/stub_stdout.py

# 
# Path: googkit/commands/download.py
# class DownloadCommand(Command):
#     @classmethod
#     def needs_project_config(cls):
#         return True
# 
#     def download_closure_library(self):
#         """Downloads Closure Library resources to the library root that defined in a config file.
#         """
#         library_repos = self.config.library_repos()
#         library_root = self.config.library_root()
# 
#         logging.info(_('Downloading Closure Library...'))
# 
#         try:
#             googkit.lib.clone.run(library_repos, library_root)
#         except GoogkitError as e:
#             raise GoogkitError(
#                 _('Dowloading Closure Library failed: {message}').format(
#                     message=str(e)))
# 
#         logging.info('Done.')
# 
#     def download_closure_compiler(self):
#         """Downloads Closure Compiler resources to the compiler root that defined in a config file.
#         """
#         tmp_path = tempfile.mkdtemp()
#         compiler_zip = os.path.join(tmp_path, 'compiler.zip')
#         compiler_zip_url = self.config.compiler_zip()
# 
#         logging.info(_('Downloading Closure Compiler...'))
# 
#         try:
#             request.urlretrieve(compiler_zip_url, compiler_zip)
#         except IOError as e:
#             raise GoogkitError(
#                 _('Dowloading Closure Compiler failed: {message}').format(
#                     massage=str(e)))
# 
#         compiler_root = self.config.compiler_root()
# 
#         os.path.join('tools', 'sub', 'unzip.py')
# 
#         with zipfile.ZipFile(compiler_zip) as z:
#             z.extractall(compiler_root)
# 
#         shutil.rmtree(tmp_path)
# 
#         logging.info(_('Done.'))
# 
#     def run_internal(self):
#         project_root = googkit.lib.path.project_root(self.env.cwd)
#         with working_directory(project_root):
#             self.download_closure_library()
#             self.download_closure_compiler()


import unittest
import os
from test.stub_config import StubConfig
from test.stub_environment import StubEnvironment
from test.stub_stdout import StubStdout
from googkit.commands.download import DownloadCommand
from googkit.compat.unittest import mock




class TestDownloadCommand(unittest.TestCase):
    def setUp(self):
        self.env = StubEnvironment()
        self.cmd = DownloadCommand(self.env)
        self.cmd.config = StubConfig()

    def test_needs_project_config(self):

# Path: test/stub_config.py
# class StubConfig(object):
#     def __init__(self):
#         pass
# 
#     def development_dir(self):
#         return StubConfig.DEVELOPMENT_DIR
# 
#     def debug_dir(self):
#         return StubConfig.DEBUG_DIR
# 
#     def production_dir(self):
#         return StubConfig.PRODUCTION_DIR
# 
#     def compiled_js_ext(self):
#         return StubConfig.COMPILED_JS_EXT
# 
#     def test_file_pattern(self):
#         return StubConfig.TEST_FILE_PATTERN
# 
#     def library_root(self):
#         return StubConfig.LIBRARRY_ROOT
# 
#     def closurebuilder(self):
#         return StubConfig.CLOSUREBUILDER
# 
#     def depswriter(self):
#         return StubConfig.DEPSWRITER
# 
#     def compiler_root(self):
#         return StubConfig.COMPILER_ROOT
# 
#     def base_js(self):
#         return StubConfig.BASE_JS
# 
#     def multitestrunner_css(self):
#         return StubConfig.MULTI_TEST_RUNNER_CSS
# 
#     def js_dev_dir(self):
#         return StubConfig.JS_DEV_DIR
# 
#     def deps_js(self):
#         return StubConfig.DEPS_JS
# 
#     def testrunner(self):
#         return StubConfig.TESTRUNNER
# 
#     def compiler(self):
#         return StubConfig.COMPILER
# 
#     def compilation_level(self):
#         return StubConfig.COMPILATION_LEVEL
# 
#     def compiler_zip(self):
#         return StubConfig.COMPILER_LATEST_ZIP
# 
#     def library_repos(self):
#         return StubConfig.LIBRARY_GIT_REPOS
# 
#     def compiler_flagfile(self):
#         return StubConfig.COMPILER_FLAGFILE
# 
#     def compiler_flagfile_for_debug(self):
#         return StubConfig.COMPILER_FLAGFILE_FOR_DEBUG
# 
#     def linter_flagfile(self):
#         return StubConfig.LINTER_FLAGFILE
# 
# Path: test/stub_environment.py
# class StubEnvironment(object):
#     def __init__(self):
#         self.cwd = None
#         self.tree = None
#         self.argument = None
# 
# Path: test/stub_stdout.py

# 
# Path: googkit/commands/download.py
# class DownloadCommand(Command):
#     @classmethod
#     def needs_project_config(cls):
#         return True
# 
#     def download_closure_library(self):
#         """Downloads Closure Library resources to the library root that defined in a config file.
#         """
#         library_repos = self.config.library_repos()
#         library_root = self.config.library_root()
# 
#         logging.info(_('Downloading Closure Library...'))
# 
#         try:
#             googkit.lib.clone.run(library_repos, library_root)
#         except GoogkitError as e:
#             raise GoogkitError(
#                 _('Dowloading Closure Library failed: {message}').format(
#                     message=str(e)))
# 
#         logging.info('Done.')
# 
#     def download_closure_compiler(self):
#         """Downloads Closure Compiler resources to the compiler root that defined in a config file.
#         """
#         tmp_path = tempfile.mkdtemp()
#         compiler_zip = os.path.join(tmp_path, 'compiler.zip')
#         compiler_zip_url = self.config.compiler_zip()
# 
#         logging.info(_('Downloading Closure Compiler...'))
# 
#         try:
#             request.urlretrieve(compiler_zip_url, compiler_zip)
#         except IOError as e:
#             raise GoogkitError(
#                 _('Dowloading Closure Compiler failed: {message}').format(
#                     massage=str(e)))
# 
#         compiler_root = self.config.compiler_root()
# 
#         os.path.join('tools', 'sub', 'unzip.py')
# 
#         with zipfile.ZipFile(compiler_zip) as z:
#             z.extractall(compiler_root)
# 
#         shutil.rmtree(tmp_path)
# 
#         logging.info(_('Done.'))
# 
#     def run_internal(self):
#         project_root = googkit.lib.path.project_root(self.env.cwd)
#         with working_directory(project_root):
#             self.download_closure_library()
#             self.download_closure_compiler()


# Path: test/commands/test_download.py
import unittest
import os
from test.stub_config import StubConfig
from test.stub_environment import StubEnvironment
from test.stub_stdout import StubStdout
from googkit.commands.download import DownloadCommand
from googkit.compat.unittest import mock





class TestDownloadCommand(unittest.TestCase):
    def setUp(self):
        self.env = StubEnvironment()
        self.cmd = DownloadCommand(self.env)
        self.cmd.config = StubConfig()

    def test_needs_project_config(self):

        self.assertTrue(DownloadCommand.needs_project_config())