-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Sitemap assumes that all versions are translated Fix. #5535
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Logic looks good to me.
Although, I got confused with the test. Can you please expand there?
@@ -260,3 +274,11 @@ def test_sitemap_xml(self): | |||
private=True, | |||
), | |||
) | |||
self.assertNotContains( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test looks tricky to me.
We are adding a new public translated version of stable
, which I expect to be listed in the response, but we are asserting to not contains. Why it does not appear in the response?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the test we want to is a project with 3 public versions and only 1 version translated. So, in the response 2 should not appear and 1 should.
I'm not sure if I'm confused or missing something here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@humitos Here the public
project has 2 public versions latest
and stable
(ie: Latest version is created automatically). but the translation
project has only one version which is latest
. so, I'm checking that as the translation
project does not have a stable
version, stable
should not have an URL for that Translation in the sitemap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
Can you add this explanation as a comment above the assert line?
When creating this tests, I like to use descriptive names on things when possible. For example, the slug for the stable
version in this case could be not-translated-version
(stable
is confusing since it's also created automatically).
Besides, the slug for the translated project could be something similar to translation-es
and similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then, when checking for the assert everything is clearer:
self.public.get_docs_url(
version_slug=not_translated_version.slug,
lang_slug=translation.language,
private=False,
),
It easier to note that the "not translated version" should not be shown on the sitemap xml because it's not translated :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@humitos Thanks for Pointing it out. I'll keep that in mind. I have updated the PR have a Look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @saadmk11! I appreciate your work here :)
@humitos Thank you for you guidance! 💯 |
closes #5365