Skip to content

Commit

Permalink
[ISV-1537] Operator pipeline image's create_repository fails if proje…
Browse files Browse the repository at this point in the history
…ct container has no "repository_description" (#438)

Signed-off-by: Maurizio Porrato <mporrato@redhat.com>
  • Loading branch information
mporrato authored Apr 19, 2023
1 parent 6274832 commit 0c26afc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def create_repository(args: Any, project: Dict[str, Any]) -> Any:
long_description = container.get("repository_description") or " "
# strip html, trim by word boundary, max length 100, add ellipsis
short_description = html2text.html2text(long_description)
short_description = textwrap.wrap(short_description, 97)[0] + "..."
short_description = textwrap.shorten(short_description, 97, placeholder="...")

display_data = {
"name": project.get("name", ""),
Expand Down
7 changes: 4 additions & 3 deletions operator-pipeline-images/tests/entrypoints/test_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_create_repository(mock_get_vendor: MagicMock, mock_post: MagicMock) ->
"container": {
"distribution_method": "rhcc",
"repository_name": "repo_name",
"repository_description": "descrip",
"repository_description": "very long description " * 10,
"release_category": "rel_cat",
"privileged": True,
"application_categories": "app_cat",
Expand All @@ -109,8 +109,9 @@ def test_create_repository(mock_get_vendor: MagicMock, mock_post: MagicMock) ->
"release_categories": ["rel_cat"],
"display_data": {
"name": "project_name",
"long_description": "descrip",
"short_description": "descrip...",
"long_description": "very long description " * 10,
"short_description": "very long description very long description "
"very long description very long description very...",
},
"non_production_only": False,
"privileged_images_allowed": True,
Expand Down

0 comments on commit 0c26afc

Please sign in to comment.