File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 22
33Installed as package by ` pip install fastapi-efficient-sql `
44
5- Install developing requirements by ` pipenv install --skip-lock --dev `
5+ Install developing requirements by ` pipenv install --skip-lock --dev ` or ` pip install -r requirements-dev.txt `
66
77Run unittest by ` pytest -sv `
88
Original file line number Diff line number Diff line change 1+ from unittest import TestCase
2+
3+ from tortoise import fields
4+
5+ from examples .service .models .demo import Account
6+ from fastapi_esql import AppMetaclass , BaseManager , BaseModel
7+
8+
9+ class DemoMetaclass (AppMetaclass ):
10+
11+ def get_ro_conn (self ):
12+ return None
13+
14+
15+ class TestOrm (TestCase ):
16+ def test_no_model (self ):
17+ with self .assertRaises (NotImplementedError ):
18+ class AccountMgr (BaseManager , metaclass = DemoMetaclass ):
19+ ...
20+
21+ def test_model_without_table (self ):
22+ with self .assertRaises (NotImplementedError ):
23+ class MyModel (BaseModel ):
24+ id = fields .IntField (pk = True )
25+
26+ class AccountMgr (BaseManager , metaclass = DemoMetaclass ):
27+ model = MyModel
28+
29+ def test_no_conn (self ):
30+ with self .assertRaises (NotImplementedError ):
31+ class AccountMgr (BaseManager , metaclass = DemoMetaclass ):
32+ model = Account
33+ AccountMgr .rw_conn
You can’t perform that action at this time.
0 commit comments