2024-07-11 12:55:55 -05:00
|
|
|
# -*- coding: utf-8; -*-
|
|
|
|
|
|
|
|
from unittest import TestCase
|
|
|
|
|
|
|
|
try:
|
2024-08-30 20:30:09 -05:00
|
|
|
from wuttjamaican.db.model import base as mod
|
2024-07-14 15:47:39 -05:00
|
|
|
from wuttjamaican.db.model.auth import User
|
2024-07-11 12:55:55 -05:00
|
|
|
except ImportError:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
|
|
|
|
class TestSetting(TestCase):
|
|
|
|
|
|
|
|
def test_basic(self):
|
2024-08-30 20:30:09 -05:00
|
|
|
setting = mod.Setting()
|
2024-07-11 12:55:55 -05:00
|
|
|
self.assertEqual(str(setting), "")
|
|
|
|
setting.name = 'foo'
|
|
|
|
self.assertEqual(str(setting), "foo")
|
2024-07-14 15:47:39 -05:00
|
|
|
|
|
|
|
class TestPerson(TestCase):
|
|
|
|
|
|
|
|
def test_basic(self):
|
2024-08-30 20:30:09 -05:00
|
|
|
person = mod.Person()
|
2024-07-14 15:47:39 -05:00
|
|
|
self.assertEqual(str(person), "")
|
|
|
|
person.full_name = "Barney Rubble"
|
|
|
|
self.assertEqual(str(person), "Barney Rubble")
|
|
|
|
|
|
|
|
def test_users(self):
|
2024-08-30 20:30:09 -05:00
|
|
|
person = mod.Person()
|
2024-07-14 15:47:39 -05:00
|
|
|
self.assertIsNone(person.user)
|
|
|
|
|
|
|
|
user = User()
|
|
|
|
person.users.append(user)
|
|
|
|
self.assertIs(person.user, user)
|