installed_app_test.py 文件源码

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

项目:appbackendapi 作者: codesdk 项目源码 文件源码
def test_main(cloud_config, monkeypatch, capsys):
    installed_app.CLIENT_SECRETS = cloud_config.client_secrets

    # Replace the user credentials flow with Application Default Credentials.
    # Unfortunately, there's no easy way to fully test the user flow.
    def mock_run_flow(flow, storage, args):
        return GoogleCredentials.get_application_default()

    monkeypatch.setattr(installed_app.tools, 'run_flow', mock_run_flow)

    args = Namespace(
        project_id=cloud_config.project,
        logging_level='INFO',
        noauth_local_webserver=True)

    installed_app.main(args)

    out, _ = capsys.readouterr()

    assert re.search(re.compile(
        r'bigquery#datasetList', re.DOTALL), out)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号