From 5a6af41353db91853b256afe0a552395490c14be Mon Sep 17 00:00:00 2001 From: git-hyagi <45576767+git-hyagi@users.noreply.github.com> Date: Fri, 17 Jan 2025 15:51:06 -0300 Subject: [PATCH] draft --- .../tests/functional/api/test_x509_certguard.py | 11 +++++++++-- pulp_file/pytest_plugin.py | 6 +++--- pulpcore/app/serializers/fields.py | 2 +- pulpcore/app/serializers/status.py | 4 +++- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pulp_certguard/tests/functional/api/test_x509_certguard.py b/pulp_certguard/tests/functional/api/test_x509_certguard.py index b190016456..06f4ae788f 100644 --- a/pulp_certguard/tests/functional/api/test_x509_certguard.py +++ b/pulp_certguard/tests/functional/api/test_x509_certguard.py @@ -77,11 +77,18 @@ def parameterized_cert(request): class TestX509CertGuard: """A test class to share the costly distribution setup.""" - def test_download(self, x509_guarded_distribution, parameterized_cert, content_path): + def test_download( + self, + x509_guarded_distribution, + parameterized_cert, + content_path, + file_distribution_base_url, + ): cert_data, status_code = parameterized_cert + distribution_base_url = file_distribution_base_url(x509_guarded_distribution.base_url) response = requests.get( - urljoin(x509_guarded_distribution.base_url, content_path), + urljoin(distribution_base_url, content_path), headers=cert_data and {"X-CLIENT-CERT": cert_data}, ) assert response.status_code == status_code diff --git a/pulp_file/pytest_plugin.py b/pulp_file/pytest_plugin.py index 4c513988b0..2fb94cf67a 100644 --- a/pulp_file/pytest_plugin.py +++ b/pulp_file/pytest_plugin.py @@ -389,6 +389,6 @@ def file_distribution_base_url(bindings_cfg): def _file_distribution_base_url(base_url): if base_url.startswith("http"): return base_url - return bindings_cfg.host+base_url - - return _file_distribution_base_url \ No newline at end of file + return bindings_cfg.host + base_url + + return _file_distribution_base_url diff --git a/pulpcore/app/serializers/fields.py b/pulpcore/app/serializers/fields.py index ca41491ad2..0c9bd3afa9 100644 --- a/pulpcore/app/serializers/fields.py +++ b/pulpcore/app/serializers/fields.py @@ -311,7 +311,7 @@ class BaseURLField(serializers.CharField): """ def to_representation(self, value): - origin = '/' + origin = "/" if settings.CONTENT_ORIGIN: origin = settings.CONTENT_ORIGIN.strip("/") prefix = settings.CONTENT_PATH_PREFIX.strip("/") diff --git a/pulpcore/app/serializers/status.py b/pulpcore/app/serializers/status.py index 87926af2da..76e8d1a151 100644 --- a/pulpcore/app/serializers/status.py +++ b/pulpcore/app/serializers/status.py @@ -72,7 +72,9 @@ class ContentSettingsSerializer(serializers.Serializer): content_origin = serializers.CharField( help_text=_("The CONTENT_ORIGIN setting for this Pulp instance"), - allow_blank=True, allow_null=True, required=False, + allow_blank=True, + allow_null=True, + required=False, ) content_path_prefix = serializers.CharField( help_text=_("The CONTENT_PATH_PREFIX setting for this Pulp instance"),