2
0
Fork 0
wuttjamaican/tests/db/model/test_base.py

35 lines
894 B
Python
Raw Normal View History

# -*- coding: utf-8; -*-
from unittest import TestCase
try:
from wuttjamaican.db.model import base as mod
from wuttjamaican.db.model.auth import User
except ImportError:
pass
else:
class TestSetting(TestCase):
def test_basic(self):
setting = mod.Setting()
self.assertEqual(str(setting), "")
setting.name = 'foo'
self.assertEqual(str(setting), "foo")
class TestPerson(TestCase):
def test_basic(self):
person = mod.Person()
self.assertEqual(str(person), "")
person.full_name = "Barney Rubble"
self.assertEqual(str(person), "Barney Rubble")
def test_users(self):
person = mod.Person()
self.assertIsNone(person.user)
user = User()
person.users.append(user)
self.assertIs(person.user, user)