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

10 statements  

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

1"""Module for testing the 'Update Team' use case.""" 

2 

3import pytest 

4 

5from kwai_bc_teams.repositories.team_db_repository import TeamDbRepository 

6from kwai_bc_teams.update_team import UpdateTeam, UpdateTeamCommand 

7from kwai_core.db.database import Database 

8 

9 

10pytestmark = pytest.mark.db 

11 

12 

13async def test_update_team(database: Database, make_team_in_db, team_presenter): 

14 """Test the use case 'Update Team'.""" 

15 team = await make_team_in_db() 

16 command = UpdateTeamCommand( 

17 id=team.id.value, 

18 name=team.name, 

19 active=team.active, 

20 remark="This is a test.", 

21 ) 

22 await UpdateTeam(TeamDbRepository(database), team_presenter).execute(command) 

23 assert team_presenter.entity.remark == "This is a test.", ( 

24 "The team should be updated." 

25 )