Skip to content

Commit

Permalink
allow overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
hsheth2 committed May 15, 2024
1 parent f3bb217 commit 9e67028
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ def _resolve_connection(cls: Type, values: dict) -> dict:
)

# TODO: Should this do some additional validation against the config model?
# TODO: Make this not overwrite existing values.
values.update(conn)

# Update the config, but don't overwrite existing values.
for key, value in conn.items():
if key not in values:
values[key] = value

return values

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def test_auto_connection_resolver():
config = MyConnectionType.parse_obj(
{
"connection": "urn:li:dataHubConnection:good-connection",
"username": "override_user",
}
)
assert config.username == "test_user"
assert config.username == "override_user"
assert config.password == "test_password"

0 comments on commit 9e67028

Please sign in to comment.