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
Improved test coverage for django.contrib.sitemaps. #8208
Improved test coverage for django.contrib.sitemaps. #8208
Conversation
1a71ee6
to
940674b
Compare
a7e067f
to
c54c09b
Compare
tests/sitemaps_tests/test_http.py
Outdated
@@ -52,6 +71,18 @@ def test_simple_sitemap_section(self): | |||
""" % (self.base_url, date.today()) | |||
self.assertXMLEqual(response.content.decode(), expected_content) | |||
|
|||
def test_simple_sitemap_no_section(self): | |||
response = self.client.get('/simple/sitemap-simple2.xml') | |||
self.assertEqual(response.status_code, 404) |
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.
You can check str(response.context['exception'] is '"No sitemap available for section..."
to improve these 404 tests.
tests/sitemaps_tests/test_http.py
Outdated
@@ -27,6 +27,25 @@ def test_simple_sitemap_index(self): | |||
""" % self.base_url | |||
self.assertXMLEqual(response.content.decode(), expected_content) | |||
|
|||
def test_simple_sitemap_index_not_callable(self): | |||
"A simple sitemap index can be rendered" |
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 the same as the previous docstring -- can it be differentiated?
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.
If this is exactly the same as the above test, was the goal to add a new test or should this be removed for the time being?
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.
Only the docstring is the same, obviously the test is different.
tests/sitemaps_tests/test_http.py
Outdated
self.assertXMLEqual(response.content.decode(), expected_content) | ||
|
||
def test_simple_sitemap_index_paged(self): | ||
response = self.client.get('/simple-paged/index.xml') |
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.
Add docstring?
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.
Reference on how to add docstring?
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.
You don't know what a docstring is? Trying googling "python docstring".
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.
Sorry, was thinking of something else.
c54c09b
to
02a0484
Compare
I made the changes. |
02a0484
to
0eefda4
Compare
No description provided.