Coverage for src/tests/modules/teams/test_delete_team.py: 100%

13 statements  

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

1"""Module for testing the Delete Team use case.""" 

2 

3import pytest 

4 

5from kwai_bc_teams.delete_team import DeleteTeam, DeleteTeamCommand 

6from kwai_bc_teams.repositories.team_db_repository import TeamDbRepository 

7from kwai_bc_teams.repositories.team_repository import TeamNotFoundException 

8from kwai_core.db.database import Database 

9 

10 

11pytestmark = pytest.mark.db 

12 

13 

14async def test_delete_team(database: Database, make_team_in_db): 

15 """Test deleting a team.""" 

16 team = await make_team_in_db() 

17 command = DeleteTeamCommand(id=team.id.value) 

18 team_repo = TeamDbRepository(database) 

19 await DeleteTeam(team_repo).execute(command) 

20 

21 with pytest.raises(TeamNotFoundException): 

22 await team_repo.get(team_repo.create_query().filter_by_id(team.id))