Skip to content

Formalize URLPatternsTestCase #5703

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

Merged
merged 4 commits into from
Jan 2, 2018

Conversation

rpkilby
Copy link
Member

@rpkilby rpkilby commented Dec 22, 2017

In working on #5609, I found myself reusing the URLPatternsTestCase from the API versioning tests. This PR formalizes it with tests and docs, as well as refactoring the router tests (per #5609). If we don't want to formalize this, an alternative would be to just move this under the tests.utils module, and use it internally.

@rpkilby rpkilby added this to the 3.8 Release milestone Dec 22, 2017
@rpkilby rpkilby force-pushed the urlpatterns-testcase branch 3 times, most recently from c8286c1 to 683f1f4 Compare December 22, 2017 05:56
"""
url = reverse('account-list')
response = self.client.get(url, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
Copy link
Member

Choose a reason for hiding this comment

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

how about using pytest style asserts?

Copy link
Member Author

@rpkilby rpkilby Dec 23, 2017

Choose a reason for hiding this comment

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

Consistency with the other test case docs. That said, the testing doc does use a mix of both pytest and unittest assertions, although I'd probably opt for the latter given that they're part of the standard library.

Copy link
Collaborator

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

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

Yep. OK. 👍

@carltongibson carltongibson merged commit b659677 into encode:master Jan 2, 2018
@rpkilby rpkilby deleted the urlpatterns-testcase branch January 3, 2018 22:53
pchiquet pushed a commit to pchiquet/django-rest-framework that referenced this pull request Nov 17, 2020
* Add formalized URLPatternsTestCase

* Update versioning tests w/ new URLPatternsTestCase

* Cleanup router tests urlpatterns

* Add docs for URLPatternsTestCase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants