-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
테스트 세션을 시작하면 테스트 컨테이너를 통해 객체를 구성하고, 테스트 케이스에서 이를 사용
- Loading branch information
Showing
3 changed files
with
18 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from test.appl.container import compose_container | ||
from test.appl.container import container as _container | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def container(): | ||
compose_container() | ||
return _container |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
import datetime | ||
|
||
from src.appl.container import Container | ||
from src.appl.create_calendar import CreateCalendar | ||
from src.infra.db.mapper import map_between_model_and_schema | ||
from src.appl.i_container import IContainer | ||
|
||
|
||
class TestCreateCalendar: | ||
def test_run(self): | ||
map_between_model_and_schema() | ||
container = Container() | ||
container.compose() | ||
def test_run(self, container: IContainer): | ||
command = container.resolve(CreateCalendar) | ||
|
||
name = "고도" | ||
birthday = datetime.date(1988, 6, 21) | ||
lifespan = 80 | ||
command.run(name, birthday, lifespan) | ||
|
||
assert command.calendar_repo.save.call_count == 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters