Coverage for src/tests/modules/training/test_get_coaches.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2024-01-01 00:00 +0000

1"""Module for testing the GetCoaches use case.""" 

2 

3from kwai_bc_training.coaches.coach import CoachEntity 

4from kwai_bc_training.coaches.coach_db_repository import CoachDbRepository 

5from kwai_bc_training.get_coaches import GetCoaches, GetCoachesCommand 

6from kwai_core.db.database import Database 

7from kwai_core.domain.presenter import CountIterableAsyncPresenter 

8 

9 

10async def test_get_coaches(database: Database, make_coach_in_db): 

11 """Test the get coaches use case.""" 

12 await make_coach_in_db() 

13 

14 command = GetCoachesCommand(active=True) 

15 coach_repo = CoachDbRepository(database) 

16 presenter = CountIterableAsyncPresenter[CoachEntity]() 

17 await GetCoaches(coach_repo, presenter).execute(command) 

18 assert presenter.count > 0, "There should be at least one result"