6
6
import pytest
7
7
8
8
from pyatlan .client .atlan import AtlanClient
9
+ from pyatlan .client .impersonate import ImpersonationClient
9
10
from pyatlan .pkg .models import CustomPackage , generate
10
11
from pyatlan .pkg .ui import UIConfig , UIStep
11
- from pyatlan .pkg .utils import set_package_headers
12
+ from pyatlan .pkg .utils import get_client , set_package_headers
12
13
from pyatlan .pkg .widgets import TextInput
13
14
14
15
@@ -21,6 +22,9 @@ def mock_pkg_env():
21
22
"X_ATLAN_AGENT_ID" : "agent_id_value" ,
22
23
"X_ATLAN_AGENT_PACKAGE_NAME" : "package_name_value" ,
23
24
"X_ATLAN_AGENT_WORKFLOW_ID" : "workflow_id_value" ,
25
+ "X_ATLAN_AGENT_WORKFLOW_ID" : "workflow_id_value" ,
26
+ "CLIENT_ID" : "client_id_value" ,
27
+ "CLIENT_SECRET" : "client_secret_value" ,
24
28
},
25
29
clear = True ,
26
30
):
@@ -104,3 +108,16 @@ def test_set_package_headers(client: AtlanClient, mock_pkg_env):
104
108
}
105
109
mock_client .update_headers .assert_called_once_with (expected_headers )
106
110
assert updated_client == mock_client
111
+
112
+
113
+ @patch .object (ImpersonationClient , "user" , return_value = "some-api-key" )
114
+ def test_get_client_user_id_handling (
115
+ mock_impersonate_client ,
116
+ mock_pkg_env ,
117
+ client : AtlanClient ,
118
+ ):
119
+ updated_client = get_client (impersonate_user_id = "test-user-id" )
120
+ assert updated_client
121
+ assert updated_client .base_url
122
+ assert updated_client .api_key == "some-api-key"
123
+ assert updated_client ._user_id == "test-user-id"
0 commit comments