Skip to content

Commit

Permalink
draft
Browse files Browse the repository at this point in the history
  • Loading branch information
git-hyagi committed Jan 17, 2025
1 parent 951fe6b commit 5a6af41
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
11 changes: 9 additions & 2 deletions pulp_certguard/tests/functional/api/test_x509_certguard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions pulp_file/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
return bindings_cfg.host + base_url

return _file_distribution_base_url
2 changes: 1 addition & 1 deletion pulpcore/app/serializers/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("/")
Expand Down
4 changes: 3 additions & 1 deletion pulpcore/app/serializers/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down

0 comments on commit 5a6af41

Please sign in to comment.