|
1 | 1 | import contextlib
|
2 |
| -import json |
3 | 2 | from typing import List
|
4 | 3 | from unittest.mock import patch
|
5 | 4 |
|
@@ -110,7 +109,6 @@ def test_get_ml_model_properties_mcps(source: VertexAISource) -> None:
|
110 | 109 |
|
111 | 110 | # Run _gen_ml_model_mcps
|
112 | 111 | actual_mcps = list(source._gen_ml_model_mcps(model_meta))
|
113 |
| - |
114 | 112 | actual_urns = [mcp.entityUrn for mcp in actual_mcps]
|
115 | 113 | expected_urns = [
|
116 | 114 | source._make_ml_model_urn(
|
@@ -362,31 +360,29 @@ def test_vertexai_config_init():
|
362 | 360 | assert config.credential.client_id == "test-client-id"
|
363 | 361 | assert config.credential.auth_uri == "https://accounts.google.com/o/oauth2/auth"
|
364 | 362 | assert config.credential.token_uri == "https://oauth2.googleapis.com/token"
|
| 363 | + assert config.credential.auth_provider_x509_cert_url == "service_account" |
| 364 | + |
| 365 | + parsed_conf = config.get_credentials() |
| 366 | + assert parsed_conf is not None |
| 367 | + assert parsed_conf.get("project_id") == config_data["project_id"] |
| 368 | + assert "credential" in config_data |
| 369 | + assert parsed_conf.get("private_key_id", "") == "test-key-id" |
| 370 | + assert ( |
| 371 | + parsed_conf.get("private_key", "") |
| 372 | + == "-----BEGIN PRIVATE KEY-----\ntest-private-key\n-----END PRIVATE KEY-----\n" |
| 373 | + ) |
| 374 | + assert ( |
| 375 | + parsed_conf.get("client_email") |
| 376 | + |
| 377 | + ) |
| 378 | + assert parsed_conf.get("client_id") == "test-client-id" |
| 379 | + assert parsed_conf.get("auth_uri") == "https://accounts.google.com/o/oauth2/auth" |
| 380 | + assert parsed_conf.get("token_uri") == "https://oauth2.googleapis.com/token" |
365 | 381 | assert (
|
366 |
| - config.credential.auth_provider_x509_cert_url |
| 382 | + parsed_conf.get("auth_provider_x509_cert_url") |
367 | 383 | == "https://www.googleapis.com/oauth2/v1/certs"
|
368 | 384 | )
|
369 |
| - |
370 |
| - assert config._credentials_path is not None |
371 |
| - with open(config._credentials_path, "r") as file: |
372 |
| - content = json.loads(file.read()) |
373 |
| - assert content["project_id"] == "test-project" |
374 |
| - assert content["private_key_id"] == "test-key-id" |
375 |
| - assert content["private_key_id"] == "test-key-id" |
376 |
| - assert ( |
377 |
| - content["private_key"] |
378 |
| - == "-----BEGIN PRIVATE KEY-----\ntest-private-key\n-----END PRIVATE KEY-----\n" |
379 |
| - ) |
380 |
| - assert ( |
381 |
| - content[ "client_email"] == "[email protected]" |
382 |
| - ) |
383 |
| - assert content["client_id"] == "test-client-id" |
384 |
| - assert content["auth_uri"] == "https://accounts.google.com/o/oauth2/auth" |
385 |
| - assert content["token_uri"] == "https://oauth2.googleapis.com/token" |
386 |
| - assert ( |
387 |
| - content["auth_provider_x509_cert_url"] |
388 |
| - == "https://www.googleapis.com/oauth2/v1/certs" |
389 |
| - ) |
| 385 | + assert parsed_conf.get("type") == "service_account" |
390 | 386 |
|
391 | 387 |
|
392 | 388 | def test_get_input_dataset_mcps(source: VertexAISource) -> None:
|
|
0 commit comments