1010API_TOKEN_NAME = f"{ MODULE_NAME } "
1111
1212
13- def create_token (client : AtlanClient , name : str ) -> ApiToken :
14- t = client .token .create (name )
13+ def create_token (token_client : AtlanClient , name : str ) -> ApiToken :
14+ t = token_client .token .create (name )
1515 return t
1616
1717
18- def delete_token (client : AtlanClient , token : Optional [ApiToken ] = None ):
18+ def delete_token (token_client : AtlanClient , token : Optional [ApiToken ] = None ):
1919 # If there is a partial failure on the server side
2020 # and the token is still visible in the Atlan UI,
2121 # in that case, the create method may not return a token.
2222 # We should retrieve the list of all tokens and delete them here.
2323 if not token :
24- tokens = client .token .get ().records
24+ tokens = token_client .token .get ().records
2525 assert tokens
2626 delete_tokens = [
2727 token
@@ -30,20 +30,20 @@ def delete_token(client: AtlanClient, token: Optional[ApiToken] = None):
3030 ]
3131 for token in delete_tokens :
3232 assert token and token .guid
33- client .token .purge (token .guid )
33+ token_client .token .purge (token .guid )
3434 return
3535 # In case of no partial failure, directly delete the token
36- token .guid and client .token .purge (token .guid )
36+ token .guid and token_client .token .purge (token .guid )
3737
3838
3939@pytest .fixture (scope = "module" )
40- def token (client : AtlanClient ) -> Generator [ApiToken , None , None ]:
40+ def token (token_client : AtlanClient ) -> Generator [ApiToken , None , None ]:
4141 token = None
4242 try :
43- token = create_token (client , API_TOKEN_NAME )
43+ token = create_token (token_client , API_TOKEN_NAME )
4444 yield token
4545 finally :
46- delete_token (client , token )
46+ delete_token (token_client , token )
4747
4848
4949def test_create_token (client : AtlanClient , token : ApiToken ):
0 commit comments