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


import unittest
import doctest
import os
import subprocess
import googkit.lib.strutil
import googkit.commands.build
from googkit.compat.unittest import mock
from test.stub_config import StubConfig, StubConfigOnStubProject
from test.stub_environment import StubEnvironment
            StubConfigOnStubProject.PRODUCTION_DIR,
            ignore='IGNORE')

        self.cmd.compile_resource.assert_any_call(
            os.path.join(StubConfigOnStubProject.PRODUCTION_DIR, 'index.html'))

    def test_debug_arguments(self):
        expected = BuildCommand.BuilderArguments()
        expected.builder_arg('--root',
                             os.path.relpath(StubConfig.LIBRARRY_ROOT, StubConfig.PROJECT_DIR))
        expected.builder_arg('--root', StubConfig.JS_DEV_DIR)
        expected.builder_arg('--namespace', 'googkit_dummy')
        expected.builder_arg('--output_mode', 'compiled')
        expected.builder_arg('--output_file', 'dummy.JS')
        expected.builder_arg('--compiler_jar', StubConfig.COMPILER)
        expected.compiler_arg('--compilation_level', 'COMPILATION_LEVEL')
        expected.compiler_arg('--source_map_format', 'V3')
        expected.compiler_arg('--create_source_map', 'dummy.JS.map')
        expected.compiler_arg('--output_wrapper', '"%output%//# sourceMappingURL={path}"'.format(path='dummy.JS.map'))

        self.cmd.compiled_js_path = mock.MagicMock()
        self.cmd.compiled_js_path.side_effect = lambda _: 'dummy.JS'

        with mock.patch('os.path.exists', return_value=False):
            args = self.cmd.debug_arguments('dummy.html', StubConfig.PROJECT_DIR)
        self.assertEqual(args, expected)

    def test_production_arguments(self):
        expected = BuildCommand.BuilderArguments()
        expected.builder_arg('--root',

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


# Path: test/commands/test_build.py
import unittest
import doctest
import os
import subprocess
import googkit.lib.strutil
import googkit.commands.build
from googkit.compat.unittest import mock
from test.stub_config import StubConfig, StubConfigOnStubProject
from test.stub_environment import StubEnvironment

            StubConfigOnStubProject.PRODUCTION_DIR,
            ignore='IGNORE')

        self.cmd.compile_resource.assert_any_call(
            os.path.join(StubConfigOnStubProject.PRODUCTION_DIR, 'index.html'))

    def test_debug_arguments(self):
        expected = BuildCommand.BuilderArguments()
        expected.builder_arg('--root',
                             os.path.relpath(StubConfig.LIBRARRY_ROOT, StubConfig.PROJECT_DIR))
        expected.builder_arg('--root', StubConfig.JS_DEV_DIR)
        expected.builder_arg('--namespace', 'googkit_dummy')
        expected.builder_arg('--output_mode', 'compiled')
        expected.builder_arg('--output_file', 'dummy.JS')
        expected.builder_arg('--compiler_jar', StubConfig.COMPILER)
        expected.compiler_arg('--compilation_level', 'COMPILATION_LEVEL')
        expected.compiler_arg('--source_map_format', 'V3')
        expected.compiler_arg('--create_source_map', 'dummy.JS.map')
        expected.compiler_arg('--output_wrapper', '"%output%//# sourceMappingURL={path}"'.format(path='dummy.JS.map'))

        self.cmd.compiled_js_path = mock.MagicMock()
        self.cmd.compiled_js_path.side_effect = lambda _: 'dummy.JS'

        with mock.patch('os.path.exists', return_value=False):
            args = self.cmd.debug_arguments('dummy.html', StubConfig.PROJECT_DIR)
        self.assertEqual(args, expected)

    def test_production_arguments(self):
        expected = BuildCommand.BuilderArguments()
        expected.builder_arg('--root',

                             os.path.relpath(StubConfig.LIBRARRY_ROOT, StubConfig.PROJECT_DIR))