45 lines
988 B
Python
45 lines
988 B
Python
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):
|
|
self.assertField('tags', TaggableManager)
|
|
|
|
|
|
class MapablePointTestCase(ModelTestCase, TestCase):
|
|
|
|
model = MapablePoint
|
|
|
|
def test_name(self):
|
|
self.assertCharField(
|
|
field_name='name',
|
|
min_length=10,
|
|
max_length=100
|
|
)
|
|
|
|
def test_latitude(self):
|
|
self.assertFloatField(
|
|
field_name='latitude',
|
|
min_value=-90,
|
|
max_value=90
|
|
)
|
|
|
|
def test_longitude(self):
|
|
self.assertFloatField(
|
|
field_name='longitude',
|
|
min_value=-180,
|
|
max_value=180
|
|
)
|