Exemplo n.º 1
0
    def test_998_alternative_base_dir(self):
        """It confirms the alternative base dir by specifying os environment variable.

        This test should be done at last because the mock object replaces the method of target method.
        os.environ[BURDOCK_BASE] = '/path/of/alternative/base'
        This way will fail because the environment variable will be affected after initialization of user.
        :return:
        """
        burdock_base = '/path/of/alternative/base'
        params = EasyDict({
            'project': 'test_project',
            'environment': 'testing',
            'via': 'cli'
        })
        Config.get_burdock_base = MagicMock(return_value=burdock_base)
        config = Config(params)
        self.assertEqual(config.get_base_dir(), burdock_base)
        self.assertEqual(config.get_repo_dir(), burdock_base + os.sep + DEFAULT_REPO_DIR)