Refactoring
This commit is contained in:
parent
7e4c5dcf24
commit
6b00452830
@ -1,6 +1,6 @@
|
|||||||
from django.test import Client
|
from django.test import Client
|
||||||
|
|
||||||
class ViewTestCase:
|
class ViewTestCaseMixin:
|
||||||
view = None
|
view = None
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -10,9 +10,9 @@ from lostplaces_app.views import (
|
|||||||
PlaceListView
|
PlaceListView
|
||||||
)
|
)
|
||||||
from lostplaces_app.forms import PlaceImageCreateForm, PlaceForm
|
from lostplaces_app.forms import PlaceImageCreateForm, PlaceForm
|
||||||
from lostplaces_app.tests.views import ViewTestCase
|
from lostplaces_app.tests.views import ViewTestCaseMixin
|
||||||
|
|
||||||
class TestPlaceCreateView(ViewTestCase, TestCase):
|
class TestPlaceCreateView(ViewTestCaseMixin, TestCase):
|
||||||
|
|
||||||
view = PlaceCreateView
|
view = PlaceCreateView
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ class TestPlaceCreateView(ViewTestCase, TestCase):
|
|||||||
self.assertHasForm(response, 'place_image_form', PlaceImageCreateForm)
|
self.assertHasForm(response, 'place_image_form', PlaceImageCreateForm)
|
||||||
self.assertHasForm(response, 'place_form', PlaceForm)
|
self.assertHasForm(response, 'place_form', PlaceForm)
|
||||||
|
|
||||||
class TestPlaceListView(ViewTestCase, TestCase):
|
class TestPlaceListView(ViewTestCaseMixin, TestCase):
|
||||||
view = PlaceListView
|
view = PlaceListView
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user