Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with generating slug for sharing #18986

Open
wants to merge 12 commits into
base: dev
Choose a base branch
from
2 changes: 2 additions & 0 deletions lib/galaxy/managers/sharable.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ def _slugify(self, start_with):
# Remove trailing '-'.
if slug_base.endswith("-"):
slug_base = slug_base[:-1]
if not slug_base:
slug_base = "unnamed"
return slug_base

def _default_slug_base(self, item):
Expand Down
6 changes: 6 additions & 0 deletions lib/galaxy_test/api/test_histories.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,12 @@ def test_anonymous_can_import_published(self):
}
self.dataset_populator.import_history(import_data)

def test_publish_non_alphanumeric(self):
history_name = f"تاریخچه"
arash77 marked this conversation as resolved.
Show resolved Hide resolved
history_id = self.dataset_populator.new_history(name=history_name)
response = self.dataset_populator.make_public(history_id)
assert response["username_and_slug"]
Copy link
Member

@mvdbeek mvdbeek Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you assert the actual slug?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SharingStatus model doesn't have the slug itself.
Should I split it from this one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like this:

Suggested change
assert response["username_and_slug"]
assert response["username_and_slug"].split("h/")[1] == history_name

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also assert that the history_name is in response["username_and_slug"], whatever you prefer


def test_immutable_history_update_fails(self):
history_id = self._create_history("TestHistoryForImmutability")["id"]

Expand Down
Loading