def test_not_found(self, ctx, mock_member_repository: MagicMock, sample_member, member_manager: MemberManager): # Given... mock_member_repository.search_by = MagicMock(return_value=([], 0)) mock_member_repository.delete = MagicMock( side_effect=MemberNotFoundError) # When... with raises(MemberNotFoundError): member_manager.delete(ctx, id=sample_member.id)
def test_happy_path(self, ctx, mock_member_repository: MagicMock, sample_member, member_manager: MemberManager): # When... mock_member_repository.search_by = MagicMock( return_value=([sample_member], 1)) member_manager.delete(ctx, id=sample_member.id) # Expect... mock_member_repository.delete.assert_called_once_with( ctx, sample_member.id)