2
0
Fork 0
wuttjamaican/tests/db/model/test_base.py
Lance Edgar 4c51189d41 fix: move model base class out of model subpkg
and other things, used by other packages (rattail)

otherwise when rattail imports them, the whole WJ model comes along
with it and it can interfere with sqlalchemy-continuum versioning
2024-08-30 20:30:09 -05:00

35 lines
894 B
Python

# -*- 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)