feat: add basic "auth" data models: user/role/perm
not really tested yet though, other than unit tests
This commit is contained in:
parent
7442047d0e
commit
639b0de8b1
11 changed files with 378 additions and 6 deletions
36
tests/db/model/test_auth.py
Normal file
36
tests/db/model/test_auth.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
|
||||
from unittest import TestCase
|
||||
|
||||
try:
|
||||
import sqlalchemy as sa
|
||||
from wuttjamaican.db.model import auth as model
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
|
||||
class TestRole(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
role = model.Role()
|
||||
self.assertEqual(str(role), "")
|
||||
role.name = "Managers"
|
||||
self.assertEqual(str(role), "Managers")
|
||||
|
||||
|
||||
class TestPermission(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
perm = model.Permission()
|
||||
self.assertEqual(str(perm), "")
|
||||
perm.permission = 'users.create'
|
||||
self.assertEqual(str(perm), "users.create")
|
||||
|
||||
|
||||
class TestUser(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
user = model.User()
|
||||
self.assertEqual(str(user), "")
|
||||
user.username = 'barney'
|
||||
self.assertEqual(str(user), "barney")
|
|
@ -14,7 +14,16 @@ else:
|
|||
def test_basic(self):
|
||||
column = model.uuid_column()
|
||||
self.assertIsInstance(column, sa.Column)
|
||||
self.assertIsInstance(column.type, sa.String)
|
||||
self.assertEqual(column.type.length, 32)
|
||||
|
||||
class TestUUIDFKColumn(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
column = model.uuid_column()
|
||||
self.assertIsInstance(column, sa.Column)
|
||||
self.assertIsInstance(column.type, sa.String)
|
||||
self.assertEqual(column.type.length, 32)
|
||||
|
||||
class TestSetting(TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue