# Path: gitmostwanted/tasks/github.py
# @celery.task()
# def repo_starred_star(user_id: int, access_token: str):
#     starred, code = user_starred(access_token)
#     if not starred:
#         return False
# 
#     attitudes = UserAttitude.list_liked_by_user(user_id)
# 
#     lst_in = [repo_like(s['full_name'], user_id) for s in starred
#               if not [a for a in attitudes if s['full_name'] == a.repo.full_name]]
# 
#     lst_out = [user_starred_star(r.repo.full_name, access_token) for r in attitudes
#                if not [x for x in starred if x['full_name'] == r.repo.full_name]]
# 
#     return len(lst_out), len(list(filter(None, lst_in)))


from gitmostwanted.tasks.github import repo_starred_star
from unittest import TestCase, mock


class TasksGithubTestCase(TestCase):
    @mock.patch('gitmostwanted.tasks.github.user_starred')
    def test_star_repository_with_invalid_starred(self, fake):
        fake.return_value = None, 404

# Path: gitmostwanted/tasks/github.py
# @celery.task()
# def repo_starred_star(user_id: int, access_token: str):
#     starred, code = user_starred(access_token)
#     if not starred:
#         return False
# 
#     attitudes = UserAttitude.list_liked_by_user(user_id)
# 
#     lst_in = [repo_like(s['full_name'], user_id) for s in starred
#               if not [a for a in attitudes if s['full_name'] == a.repo.full_name]]
# 
#     lst_out = [user_starred_star(r.repo.full_name, access_token) for r in attitudes
#                if not [x for x in starred if x['full_name'] == r.repo.full_name]]
# 
#     return len(lst_out), len(list(filter(None, lst_in)))


# Path: tests/unit/tasks/test_github.py
from gitmostwanted.tasks.github import repo_starred_star
from unittest import TestCase, mock



class TasksGithubTestCase(TestCase):
    @mock.patch('gitmostwanted.tasks.github.user_starred')
    def test_star_repository_with_invalid_starred(self, fake):
        fake.return_value = None, 404

        self.assertFalse(repo_starred_star(1, 'token'))