Skip to content

Commit

Permalink
Update some method names in auth
Browse files Browse the repository at this point in the history
  • Loading branch information
Tranquility2 committed Jul 13, 2024
1 parent 3950449 commit 7db56ae
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions core/testcontainers/core/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
}


def parse_docker_auth_config_encoded(auth_config_dict: dict) -> list[DockerAuthInfo]:
def process_docker_auth_config_encoded(auth_config_dict: dict) -> list[DockerAuthInfo]:
"""
Parse the docker auth config from a string.
Process the auths config.
Example:
{
Expand All @@ -24,6 +24,8 @@ def parse_docker_auth_config_encoded(auth_config_dict: dict) -> list[DockerAuthI
}
}
}
Returns a list of DockerAuthInfo objects.
"""
auth_info: list[DockerAuthInfo] = []

Expand All @@ -37,9 +39,9 @@ def parse_docker_auth_config_encoded(auth_config_dict: dict) -> list[DockerAuthI
return auth_info


def parse_docker_auth_config_cred_helpers(auth_config_dict: dict) -> None:
def process_docker_auth_config_cred_helpers(auth_config_dict: dict) -> None:
"""
Parse the docker auth config from a string.
Process the credHelpers config.
Example:
{
Expand All @@ -54,9 +56,9 @@ def parse_docker_auth_config_cred_helpers(auth_config_dict: dict) -> None:
warning(_AUTH_WARNINGS.pop("credHelpers"))


def parse_docker_auth_config_store(auth_config_dict: dict) -> None:
def process_docker_auth_config_store(auth_config_dict: dict) -> None:
"""
Parse the docker auth config from a string.
Process the credsStore config.
Example:
{
Expand All @@ -74,11 +76,11 @@ def parse_docker_auth_config(auth_config: str) -> Optional[list[DockerAuthInfo]]
try:
auth_config_dict: dict = json.loads(auth_config)
if "auths" in auth_config:
return parse_docker_auth_config_encoded(auth_config_dict)
return process_docker_auth_config_encoded(auth_config_dict)
elif "credHelpers" in auth_config:
parse_docker_auth_config_cred_helpers(auth_config_dict)
process_docker_auth_config_cred_helpers(auth_config_dict)
elif "credsStore" in auth_config:
parse_docker_auth_config_store(auth_config_dict)
process_docker_auth_config_store(auth_config_dict)

except (json.JSONDecodeError, KeyError, ValueError) as exp:
raise ValueError("Could not parse docker auth config") from exp
Expand Down

0 comments on commit 7db56ae

Please sign in to comment.