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)
评论列表
文章目录