Skip to content

Commit

Permalink
Fix from_config messing up headers
Browse files Browse the repository at this point in the history
An extra comma creating a tuple made the function unusable.
  • Loading branch information
mdellweg committed Sep 23, 2024
1 parent 5ef56bc commit 7d29848
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGES/+from_config.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes `from_config` call that messed up the headers attribute.
4 changes: 2 additions & 2 deletions pulp-glue/pulp_glue/common/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ def from_config(cls, config: t.Dict[str, t.Any]) -> "t.Self":
if "username" in config:
api_kwargs["auth_provider"] = BasicAuthProvider(config["username"], config["password"])
if "headers" in config:
api_kwargs["headers"] = (
dict((header.split(":", maxsplit=1) for header in config["headers"])),
api_kwargs["headers"] = dict(
(header.split(":", maxsplit=1) for header in config["headers"])
)
for key in ["cert", "key", "user_agent", "cid"]:
if key in config:
Expand Down
20 changes: 3 additions & 17 deletions pulp-glue/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,9 @@ def pulp_ctx(
request: pytest.FixtureRequest, pulp_cli_settings: t.Dict[str, t.Dict[str, t.Any]]
) -> PulpContext:
verbose = request.config.getoption("verbose")
settings = pulp_cli_settings["cli"]
return PulpTestContext(
api_kwargs={
"base_url": settings["base_url"],
"auth_provider": (
BasicAuthProvider(settings.get("username"), settings.get("password"))
if "username" in settings
else None
),
"cert": settings.get("cert"),
"key": settings.get("key"),
"debug_callback": lambda i, s: i <= verbose and print(s),
},
api_root=settings.get("api_root", "pulp/"),
background_tasks=False,
timeout=settings.get("timeout", 120),
)
settings = pulp_cli_settings["cli"].copy()
settings["debug_callback"] = lambda i, s: i <= verbose and print(s)
return PulpTestContext.from_config(settings)


@pytest.fixture
Expand Down

0 comments on commit 7d29848

Please sign in to comment.