Refactoring and testing __str__
This commit is contained in:
parent
d438303aec
commit
64ed38332f
@ -4,9 +4,8 @@ from django.test import TestCase
|
||||
from django.db import models
|
||||
|
||||
from lostplaces_app.models import Place
|
||||
from lostplaces_app.tests.models import TestSubmittable
|
||||
from lostplaces_app.tests.models import SubmittableTestCase
|
||||
from lostplaces_app.tests import mock_user
|
||||
from lostplaces_app.tests.models import TestModel
|
||||
|
||||
from taggit.managers import TaggableManager
|
||||
|
||||
@ -24,7 +23,7 @@ def mock_place():
|
||||
|
||||
return place
|
||||
|
||||
class PlaceTestCase(TestSubmittable, TestCase):
|
||||
class PlaceTestCase(SubmittableTestCase, TestCase):
|
||||
model_name = 'Place'
|
||||
related_name = 'places'
|
||||
nullable = True
|
||||
@ -127,10 +126,9 @@ class PlaceTestCase(TestSubmittable, TestCase):
|
||||
)
|
||||
|
||||
def test_str(self):
|
||||
place = mock_place()
|
||||
self.assertEqual(str(place), place.name,
|
||||
msg='%s __str__ should return the name' % (
|
||||
place = self.object
|
||||
self.assertTrue(place.name.lower() in str(place).lower(),
|
||||
msg='Expecting %s.__str__ to contain the name' % (
|
||||
self.model_name
|
||||
)
|
||||
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user