Skip to content

Commit

Permalink
Add missing prn on the DistributionTree serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-psb committed Jan 28, 2025
1 parent 5f6a02c commit 5b321da
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions pulp_rpm/app/serializers/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class Meta:
model = DistributionTree
fields = (
"pulp_href",
"prn",
"header_version",
"release_name",
"release_short",
Expand Down
24 changes: 24 additions & 0 deletions pulp_rpm/tests/functional/api/test_prn.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import pytest
import requests



# @pytest.fixture(scope="session")
# def pulp_openapi_schema_rpm(pulp_api_v3_url):
# COMPONENT="rpm"
# return requests.get(f"{pulp_api_v3_url}docs/api.json?bindings&component={COMPONENT}").json()

@pytest.mark.parallel
def test_prn_schema(pulp_openapi_schema):
"""Test that PRN is a part of every serializer with a pulp_href."""
failed = []
for name, schema in pulp_openapi_schema["components"]["schemas"].items():
if name.endswith("Response"):
if "pulp_href" in schema["properties"]:
if "prn" in schema["properties"]:
prn_schema = schema["properties"]["prn"]
if prn_schema["type"] == "string" and prn_schema["readOnly"]:
continue
failed.append(name)

assert len(failed) == 0
1 change: 1 addition & 0 deletions pulp_rpm/tests/functional/api/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,7 @@ def test_treeinfo_metadata(init_and_sync, rpm_content_distribution_trees_api):
distribution_tree = distribution_tree.to_dict()
# delete pulp-specific metadata
distribution_tree.pop("pulp_href")
distribution_tree.pop("prn")

# sort kickstart metadata so that we can compare the dicts properly
for d in [distribution_tree, RPM_KICKSTART_DATA]:
Expand Down

0 comments on commit 5b321da

Please sign in to comment.