2020-09-13 10:27:01 +02:00
|
|
|
import datetime
|
|
|
|
|
|
|
|
from django.test import TestCase
|
|
|
|
from django.db import models
|
|
|
|
from django.contrib.auth.models import User
|
|
|
|
|
|
|
|
from lostplaces_app.models import Place, Taggable, MapablePoint
|
|
|
|
from lostplaces_app.tests.models import ModelTestCase
|
|
|
|
|
|
|
|
from taggit.managers import TaggableManager
|
|
|
|
|
|
|
|
|
|
|
|
class TaggableTestCase(ModelTestCase, TestCase):
|
|
|
|
|
|
|
|
model = Taggable
|
|
|
|
|
|
|
|
def test_tags(self):
|
2020-09-13 13:29:27 +02:00
|
|
|
self.assertField('tags', TaggableManager)
|
2020-09-13 10:27:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
class MapablePointTestCase(ModelTestCase, TestCase):
|
|
|
|
|
|
|
|
model = MapablePoint
|
|
|
|
|
|
|
|
def test_name(self):
|
|
|
|
self._test_char_field(
|
|
|
|
field_name='name',
|
|
|
|
min_length=10,
|
|
|
|
max_length=100
|
|
|
|
)
|
|
|
|
|
|
|
|
def test_latitude(self):
|
|
|
|
self._test_float_field(
|
|
|
|
field_name='latitude',
|
|
|
|
min_value=-90,
|
|
|
|
max_value=90
|
|
|
|
)
|
|
|
|
|
|
|
|
def test_longitude(self):
|
|
|
|
self._test_float_field(
|
|
|
|
field_name='longitude',
|
|
|
|
min_value=-180,
|
|
|
|
max_value=180
|
|
|
|
)
|