-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add tests for section-linking #5918
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
Add tests for section-linking #5918
Conversation
Fix count value of docsearch REST api
Is this still a WIP? |
Just some last commits. |
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 is a good upgrade, but I'm worried this will all break when we change the site design and cause a lot of extra work. Can we access the test data directly from rendering, instead of via HTML? That would make it much less brittle, and not dependent on the templates.
readthedocs/search/tests/test_api.py
Outdated
@@ -20,40 +25,112 @@ def setup_class(cls): | |||
# installed | |||
cls.url = reverse('doc_search') | |||
|
|||
@pytest.mark.parametrize('data_type', ['content', 'headers', 'title']) | |||
@pytest.mark.parametrize('data_type', ['title']) |
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.
We don't need param's here if there's only 1.
assert len(results) >= 2 # there are > 1 results without the filter | ||
|
||
# checking if `std:confval` filter is present | ||
content = page.find('.navigable .language-list').text() |
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.
Also we should fix the HTML, language-list
isn't the class we should be using, it should be role-list
.
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 also worry about depending on the HTML structure. This will break all the tests when we do our site redesign. Can we not capture this data from the query result itself? I believe the Django test client gives us template data directly, which we could use: https://docs.djangoproject.com/en/2.2/topics/testing/tools/#django.test.Response.context
@ericholscher |
Great, thanks! |
Tests