config_file_test.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:user-sync.py 作者: adobe-apiplatform 项目源码 文件源码
def test_load_root_default_config(self, mock_isfile, mock_yaml, mock_open):
        '''
        tests ConfigFileLoader.load_root_config by inputing a root configuration
        file path, and asserts that the resulting processed content has the
        file references properly updated
        :type mock_isfile: Mock
        :type mock_yaml: Mock
        :type mock_open: Mock
        '''
        mock_isfile.return_value = True
        mocked_open = mock_open('test')
        mocked_open_name = '%s.open' % __name__
        with patch(mocked_open_name, mocked_open, create=True):
            mock_yaml.return_value = {
                    'adobe_users': {'connectors': {'umapi': 'test-123'}},
                    'logging': {'log_to_file': True},
                }
            yml = ConfigFileLoader.load_root_config('config-test-2/user-sync-config-test.yml')

            # assert default values are preserved
            self.assert_eq(yml['logging']['file_log_directory'], os.path.abspath('config-test-2/logs'),
                           'default log path is missing or incorrect')

            # assert file paths are still updated properly
            self.assert_eq(yml['adobe_users']['connectors']['umapi'], os.path.abspath('config-test-2/test-123'),
                           'default primary umapi configuration path is incorrect')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号