From 75f40255a7e98ba8e551c65ab0337d865d1234b3 Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Thu, 19 Dec 2024 13:44:10 +0100 Subject: [PATCH] Fix bindings wrongly mangling response headers --- pulpcore/tests/functional/api/test_login.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pulpcore/tests/functional/api/test_login.py b/pulpcore/tests/functional/api/test_login.py index 75545c514c..8d5a605436 100644 --- a/pulpcore/tests/functional/api/test_login.py +++ b/pulpcore/tests/functional/api/test_login.py @@ -4,6 +4,21 @@ pytestmark = [pytest.mark.parallel] +@pytest.fixture(autouse=True) +def _fix_response_headers(monkeypatch, pulpcore_bindings): + """ + Fix bindings incorrectly translating HTTPHeaderDict to dict. + Ideally they wouldn't even make it a dict, but keep it whatever case insensitive multivalued + mapping the underlying http adapter provides. Alternatively translate everything into the + mutidict.CIMultiDict type. + """ + monkeypatch.setattr( + pulpcore_bindings.module.rest.RESTResponse, + "getheaders", + lambda self: dict(self.response.headers), + ) + + @pytest.fixture def session_user(pulpcore_bindings, gen_user, anonymous_user): old_cookie = pulpcore_bindings.client.cookie