diff options
| author | Josh Smeaton <josh.smeaton@gmail.com> | 2015-02-23 11:53:57 +1100 |
|---|---|---|
| committer | Josh Smeaton <josh.smeaton@gmail.com> | 2015-03-05 10:10:32 +1100 |
| commit | 39a7eed1bbf12020a077e4bec3d82e08f171a021 (patch) | |
| tree | 225be14a94d57517d9de646569498eb45d0a4352 /tests/raw_query/tests.py | |
| parent | d6969abf239d52f6dfed7384c6ceb7df7e618342 (diff) | |
Converted test fixtures to setUpTestData methods
Diffstat (limited to 'tests/raw_query/tests.py')
| -rw-r--r-- | tests/raw_query/tests.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/raw_query/tests.py b/tests/raw_query/tests.py index 5d2bf4becf..2027a32d2b 100644 --- a/tests/raw_query/tests.py +++ b/tests/raw_query/tests.py @@ -9,7 +9,22 @@ from .models import Author, Book, Coffee, FriendlyAuthor, Reviewer class RawQueryTests(TestCase): - fixtures = ['raw_query_books.json'] + + @classmethod + def setUpTestData(cls): + cls.a1 = Author.objects.create(first_name='Joe', last_name='Smith', dob=date(1950, 9, 20)) + cls.a2 = Author.objects.create(first_name='Jill', last_name='Doe', dob=date(1920, 4, 2)) + cls.a3 = Author.objects.create(first_name='Bob', last_name='Smith', dob=date(1986, 1, 25)) + cls.a4 = Author.objects.create(first_name='Bill', last_name='Jones', dob=date(1932, 5, 10)) + cls.b1 = Book.objects.create(title='The awesome book', author=cls.a1, paperback=False, opening_line='It was a bright cold day in April and the clocks were striking thirteen.') + cls.b2 = Book.objects.create(title='The horrible book', author=cls.a1, paperback=True, opening_line='On an evening in the latter part of May a middle-aged man was walking homeward from Shaston to the village of Marlott, in the adjoining Vale of Blakemore, or Blackmoor.') + cls.b3 = Book.objects.create(title='Another awesome book', author=cls.a1, paperback=False, opening_line='A squat grey building of only thirty-four stories.') + cls.b4 = Book.objects.create(title='Some other book', author=cls.a3, paperback=True, opening_line='It was the day my grandmother exploded.') + cls.c1 = Coffee.objects.create(brand='dunkin doughnuts') + cls.c2 = Coffee.objects.create(brand='starbucks') + cls.r1 = Reviewer.objects.create() + cls.r2 = Reviewer.objects.create() + cls.r1.reviewed.add(cls.b2, cls.b3, cls.b4) def assertSuccessfulRawQuery(self, model, query, expected_results, expected_annotations=(), params=[], translations=None): |
