summaryrefslogtreecommitdiff
path: root/tests/generic_views/test_list.py
diff options
context:
space:
mode:
authorJosh Smeaton <josh.smeaton@gmail.com>2015-02-23 11:53:57 +1100
committerJosh Smeaton <josh.smeaton@gmail.com>2015-03-05 10:10:32 +1100
commit39a7eed1bbf12020a077e4bec3d82e08f171a021 (patch)
tree225be14a94d57517d9de646569498eb45d0a4352 /tests/generic_views/test_list.py
parentd6969abf239d52f6dfed7384c6ceb7df7e618342 (diff)
Converted test fixtures to setUpTestData methods
Diffstat (limited to 'tests/generic_views/test_list.py')
-rw-r--r--tests/generic_views/test_list.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/generic_views/test_list.py b/tests/generic_views/test_list.py
index b9274242c9..e6ce7cb539 100644
--- a/tests/generic_views/test_list.py
+++ b/tests/generic_views/test_list.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
@@ -7,12 +8,25 @@ from django.test import TestCase, override_settings
from django.utils.encoding import force_str
from django.views.generic.base import View
-from .models import Artist, Author, Book
+from .models import Artist, Author, Book, Page
@override_settings(ROOT_URLCONF='generic_views.urls')
class ListViewTests(TestCase):
- fixtures = ['generic-views-test-data.json']
+
+ @classmethod
+ def setUpTestData(cls):
+ cls.artist1 = Artist.objects.create(name='Rene Magritte')
+ cls.author1 = Author.objects.create(name='Roberto BolaƱo', slug='roberto-bolano')
+ cls.author2 = Author.objects.create(name='Scott Rosenberg', slug='scott-rosenberg')
+ cls.book1 = Book.objects.create(name='2066', slug='2066', pages=800, pubdate=datetime.date(2008, 10, 1))
+ cls.book1.authors.add(cls.author1)
+ cls.book2 = Book.objects.create(
+ name='Dreaming in Code', slug='dreaming-in-code', pages=300, pubdate=datetime.date(2006, 5, 1)
+ )
+ cls.page1 = Page.objects.create(
+ content='I was once bitten by a moose.', template='generic_views/page_template.html'
+ )
def test_items(self):
res = self.client.get('/list/dict/')