Skip to content

Commit b7af988

Browse files
committed
did the required changes
1 parent aebfe6c commit b7af988

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

pyatlan/client/credential.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,10 @@ def creator(self, credential: Credential, test: bool = True) -> CredentialRespon
4646
(`False`) before creation, defaults to `True`.
4747
:returns: A CredentialResponse instance.
4848
:raises ValidationError: If the provided `credential` is invalid.
49+
:raises InvalidRequestError: If `test` is `False` and the credential contains a `username` or `password`.
4950
"""
5051

51-
if not test and (
52-
credential.username is not None or credential.password is not None
53-
):
52+
if not test and any((credential.username, credential.password)):
5453
raise ErrorCode.UNABLE_TO_CREATE_CREDENTIAL.exception_with_parameters()
5554

5655
raw_json = self._client._call_api(

pyatlan/errors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,8 +618,8 @@ class ErrorCode(Enum):
618618
UNABLE_TO_CREATE_CREDENTIAL = (
619619
400,
620620
"ATLAN-PYTHON-400-071",
621-
"When test is set to False, credentials can only be created without a username and password.",
622-
"Either switch test to True or remove the username and password.",
621+
"Credentials cannot include a `username` or `password` when `test` is `False`.",
622+
"Set `test` to `True` or remove `username` and `password`.",
623623
InvalidRequestError,
624624
)
625625
AUTHENTICATION_PASSTHROUGH = (

0 commit comments

Comments
 (0)