'Tests vote_count increases and decreases correctly from different users'

@ddt.data(*itertools.product([True, False], [True, False], [True, False], [True, False]))
@ddt.unpack
def test_vote_count_two_users(self, current_user1_vote, current_user2_vote, user1_vote, user2_vote):

    user2 = UserFactory.create()
    self.register_get_user_response(user2)
    request2 = RequestFactory().get('/test_path')
    request2.user = user2
    CourseEnrollmentFactory.create(user=user2, course_id=self.course.id)
    vote_count = 0
    if current_user1_vote:
        self.register_get_user_response(self.user, upvoted_ids=['test_comment'])
        vote_count += 1
    if current_user2_vote:
        self.register_get_user_response(user2, upvoted_ids=['test_comment'])
        vote_count += 1
    for (current_vote, user_vote, request) in [(current_user1_vote, user1_vote, self.request), (current_user2_vote, user2_vote, request2)]:
        self.register_comment_votes_response('test_comment')
        self.register_comment(overrides={'votes': {'up_count': vote_count}})
        data = {'voted': user_vote}
        result = update_comment(request, 'test_comment', data)
        if (current_vote == user_vote):
            self.assertEqual(result['vote_count'], vote_count)
        elif user_vote:
            vote_count += 1
            self.assertEqual(result['vote_count'], vote_count)
            self.register_get_user_response(self.user, upvoted_ids=['test_comment'])
        else:
            vote_count -= 1
            self.assertEqual(result['vote_count'], vote_count)
            self.register_get_user_response(self.user, upvoted_ids=[])
