lostplaces-backend/lostplaces/lostplaces_app/tests/models/test_abstract_models.py

45 lines
991 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._test_field('tags', TaggableManager)
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
)