Kaydet (Commit) 66394646 authored tarafından François Freitag's avatar François Freitag Kaydeden (comit) Tim Graham

Removed hardcoding from get_earliest_or_latest tests' tearDown().

üst 2ef4b479
......@@ -8,10 +8,13 @@ from .models import Article, IndexErrorArticle, Person
class EarliestOrLatestTests(TestCase):
"""Tests for the earliest() and latest() objects methods"""
@classmethod
def setUpClass(cls):
super().setUpClass()
cls._article_get_latest_by = Article._meta.get_latest_by
def tearDown(self):
"""Makes sure Article has a get_latest_by"""
if not Article._meta.get_latest_by:
Article._meta.get_latest_by = 'pub_date'
Article._meta.get_latest_by = self._article_get_latest_by
def test_earliest(self):
# Because no Articles exist yet, earliest() raises ArticleDoesNotExist.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment