Compare commits

...

2 Commits

Author SHA1 Message Date
12881d9345 Renaming MapablePoint 2020-09-14 15:18:21 +02:00
79ed029db0 Rephrasing 2020-09-14 15:16:31 +02:00
4 changed files with 14 additions and 14 deletions

View File

@ -54,7 +54,7 @@ class Taggable(models.Model):
tags = TaggableManager(blank=True)
class MapablePoint(models.Model):
class Mapable(models.Model):
'''
This abstract model class represents an object that can be
displayed on a map.
@ -109,7 +109,7 @@ class Voucher(models.Model):
return "Voucher " + str(self.code)
class Place(Submittable, Taggable, MapablePoint):
class Place(Submittable, Taggable, Mapable):
"""
Place defines a lost place (location, name, description etc.).
"""

View File

@ -6,7 +6,7 @@ from django.contrib.auth.models import User
from lostplaces_app.models import (
Taggable,
MapablePoint,
Mapable,
Submittable
)
from lostplaces_app.tests.models import ModelTestCase
@ -22,9 +22,9 @@ class TaggableTestCase(ModelTestCase):
self.assertField('tags', TaggableManager)
class MapablePointTestCase(ModelTestCase):
class MapableTestCase(ModelTestCase):
model = MapablePoint
model = Mapable
def test_name(self):
self.assertCharField(

View File

@ -1,6 +1,6 @@
from django.test import TestCase
from lostplaces_app.models import Taggable, MapablePoint
from lostplaces_app.models import Taggable, Mapable
from taggit.models import Tag
@ -59,7 +59,7 @@ class ViewTestCase(TestCase):
'''
self.assertEqual(
response.status_code, code,
"Expected an HTTP %s response, but got HTTP %s" % (
msg='Expecting an HTTP %s response, but got HTTP %s' % (
code,
response.status_code
)
@ -165,9 +165,9 @@ class TaggableViewTestCaseMixin:
msg='Expecting delete_url_name to be of type string'
)
class MapablePointViewTestCaseMixin:
class MapableViewTestCaseMixin:
def assertMapablePointContext(self, context):
def assertMapableContext(self, context):
self.assertTrue(
'all_points' in context,
msg='Expecting the context for mapable point to contain \'all_points\' attribute'
@ -175,9 +175,9 @@ class MapablePointViewTestCaseMixin:
for point in context['all_points']:
self.assertTrue(
isinstance(point, MapablePoint),
isinstance(point, Mapable),
msg='Expecting all entries to be an instance of %s, got %s' % (
str(MapablePoint),
str(Mapable),
str(type(point))
)
)

View File

@ -14,7 +14,7 @@ from lostplaces_app.forms import PlaceImageCreateForm, PlaceForm
from lostplaces_app.tests.views import (
ViewTestCase,
TaggableViewTestCaseMixin,
MapablePointViewTestCaseMixin
MapableViewTestCaseMixin
)
@ -83,7 +83,7 @@ class TestPlaceListView(ViewTestCase):
self.assertContext(response, 'mapping_config')
class PlaceDetailViewTestCase(TaggableViewTestCaseMixin, MapablePointViewTestCaseMixin, ViewTestCase):
class PlaceDetailViewTestCase(TaggableViewTestCaseMixin, MapableViewTestCaseMixin, ViewTestCase):
view = PlaceDetailView
@classmethod
@ -123,4 +123,4 @@ class PlaceDetailViewTestCase(TaggableViewTestCaseMixin, MapablePointViewTestCas
str(self.view)
)
)
self.assertMapablePointContext(response.context['mapping_config'])
self.assertMapableContext(response.context['mapping_config'])