|
8 | 8 | from ads.feature_store.mixin.oci_feature_store import OCIFeatureStoreMixin
|
9 | 9 | from ads.common.auth import AuthType
|
10 | 10 |
|
11 |
| -TEST_URL = "https://test.com" |
| 11 | +TEST_URL_1 = "https://test1.com" |
| 12 | +TEST_URL_2 = "https://test2.com" |
| 13 | +TEST_URL_3 = "https://test3.com" |
| 14 | +TEST_URL_4 = "https://test4.com" |
12 | 15 |
|
13 | 16 |
|
14 |
| -def test_manual_endpoint(): |
15 |
| - ads.set_auth(auth=AuthType.API_KEY, client_kwargs={"fs_service_endpoint": TEST_URL}) |
16 |
| - client = OCIFeatureStoreMixin.init_client(fs_service_endpoint=TEST_URL) |
17 |
| - assert client.base_client.endpoint == f"{TEST_URL}/20230101" |
| 17 | +def test_global_service_endpoint(): |
| 18 | + ads.set_auth(auth=AuthType.API_KEY, client_kwargs={"service_endpoint": TEST_URL_1}) |
| 19 | + client = OCIFeatureStoreMixin.init_client() |
| 20 | + assert client.base_client.endpoint == f"{TEST_URL_1}/20230101" |
18 | 21 |
|
19 | 22 |
|
20 |
| -def test_manual_with_service_endpoint(): |
| 23 | +def test_global_service_and_fs_endpoints(): |
21 | 24 | ads.set_auth(
|
22 | 25 | auth=AuthType.API_KEY,
|
23 | 26 | client_kwargs={
|
24 |
| - "fs_service_endpoint": TEST_URL, |
25 |
| - "service_endpoint": "service.com", |
| 27 | + "fs_service_endpoint": TEST_URL_1, |
| 28 | + "service_endpoint": TEST_URL_2, |
26 | 29 | },
|
27 | 30 | )
|
28 |
| - client = OCIFeatureStoreMixin.init_client(fs_service_endpoint=TEST_URL) |
29 |
| - assert client.base_client.endpoint == f"{TEST_URL}/20230101" |
| 31 | + client = OCIFeatureStoreMixin.init_client() |
| 32 | + assert client.base_client.endpoint == f"{TEST_URL_1}/20230101" |
30 | 33 |
|
31 | 34 |
|
32 |
| -def test_service_endpoint(): |
33 |
| - ads.set_auth(auth=AuthType.API_KEY, client_kwargs={"service_endpoint": TEST_URL}) |
34 |
| - client = OCIFeatureStoreMixin.init_client(fs_service_endpoint=TEST_URL) |
35 |
| - assert client.base_client.endpoint == f"{TEST_URL}/20230101" |
| 35 | +def test_override_service_endpoint(): |
| 36 | + ads.set_auth(auth=AuthType.API_KEY) |
| 37 | + client = OCIFeatureStoreMixin.init_client(service_endpoint=TEST_URL_1) |
| 38 | + assert client.base_client.endpoint == f"{TEST_URL_1}/20230101" |
| 39 | + |
| 40 | + |
| 41 | +def test_override_service_and_fs_endpoints(): |
| 42 | + ads.set_auth(auth=AuthType.API_KEY) |
| 43 | + client = OCIFeatureStoreMixin.init_client( |
| 44 | + service_endpoint=TEST_URL_1, fs_service_endpoint=TEST_URL_2 |
| 45 | + ) |
| 46 | + assert client.base_client.endpoint == f"{TEST_URL_2}/20230101" |
| 47 | + |
| 48 | + |
| 49 | +def test_override_service_and_fs_endpoints_with_global_service_and_fs_endpoints(): |
| 50 | + ads.set_auth( |
| 51 | + auth=AuthType.API_KEY, |
| 52 | + client_kwargs={ |
| 53 | + "fs_service_endpoint": TEST_URL_3, |
| 54 | + "service_endpoint": TEST_URL_4, |
| 55 | + }, |
| 56 | + ) |
| 57 | + client = OCIFeatureStoreMixin.init_client( |
| 58 | + service_endpoint=TEST_URL_1, fs_service_endpoint=TEST_URL_2 |
| 59 | + ) |
| 60 | + assert client.base_client.endpoint == f"{TEST_URL_2}/20230101" |
0 commit comments