Skip to content

Commit bbc99f7

Browse files
committed
unittest: EventBiz
1 parent c5ad7b4 commit bbc99f7

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

tests/demo_app/domain.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
from easy.domain import BaseDomain
2+
from tests.demo_app.models import Event
23

34

45
class EventDomain(BaseDomain):
56
pass
7+
8+
9+
class EventBiz(EventDomain):
10+
def __init__(self, model=Event):
11+
self.model = model
12+
super(EventBiz, self).__init__(self.model)

tests/demo_app/services.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from django.http import HttpRequest
44

5-
from tests.demo_app.models import Event
5+
from tests.demo_app.domain import EventBiz
66

77
if TYPE_CHECKING:
88
from ninja_extra.controllers.base import ControllerBase # pragma: no cover
@@ -11,8 +11,8 @@
1111

1212

1313
class EventService(BaseService):
14-
def __init__(self, model=Event):
15-
super().__init__(model=model)
14+
def __init__(self, biz=EventBiz()):
15+
super().__init__(biz.model)
1616

1717
@staticmethod
1818
async def prepare_create_event_data(data):

0 commit comments

Comments
 (0)