def test_check_fuzzy_double_previous_matches(self):
        self.fresh_setup()
        t = Profile.objects.get(first_name='tiffany')
        a = Profile.objects.get(first_name='andrew')
        pj = Profile.objects.get(first_name='philip')
        k = Profile.objects.get(first_name='karima')
        tim = Profile.objects.get(first_name='tim')
        mike = Profile.objects.get(first_name='michael')

        matches = [t, a, pj, k]
        emails = [prof.email for prof in matches]
        for prof in matches:
            av = GroupAvailability.objects.get(time_available_utc=self.past,
                                               profile=prof)
            av.matched_group_users = json.dumps(emails)
            av.save()

        new_matches = [tim, a, pj, mike]
        Command.match_group(Command(), self.future2, new_matches)
        group = [t]
        self.assertEqual(
            Command.check_fuzzy_previous_matches(Command(), tim, group), True)
        group = [a, pj]
        self.assertEqual(
            Command.check_fuzzy_previous_matches(Command(), tim, group), False)
        group = [a, t]
        self.assertEqual(
            Command.check_fuzzy_previous_matches(Command(), mike, group), True)
        group = [a, t, k]
        self.assertEqual(
            Command.check_fuzzy_previous_matches(Command(), mike, group), True)
        group = [mike, t, a]
        self.assertEqual(
            Command.check_fuzzy_previous_matches(Command(), k, group), False)
    def test_check_fuzzy_previous_matches(self):
        self.fresh_setup()
        t = Profile.objects.get(first_name='tiffany')
        a = Profile.objects.get(first_name='andrew')
        pj = Profile.objects.get(first_name='philip')
        k = Profile.objects.get(first_name='karima')
        tim = Profile.objects.get(first_name='tim')
        mike = Profile.objects.get(first_name='michael')

        group = [t]
        self.assertEqual(
            Command.check_fuzzy_previous_matches(Command(), tim, group), True)
        group = [a, pj]
        self.assertEqual(
            Command.check_fuzzy_previous_matches(Command(), tim, group), True)

        group = [t, a, pj, k]
        Command.match_group(Command(), self.past, group)
        self.assertEqual(
            Command.check_fuzzy_previous_matches(Command(), tim, group), True)
        self.assertEqual(
            Command.check_fuzzy_previous_matches(Command(), t, group), False)
        group = [t, pj, k]
        self.assertEqual(
            Command.check_fuzzy_previous_matches(Command(), a, group), False)
        group = [t]
        self.assertEqual(
            Command.check_fuzzy_previous_matches(Command(), a, group), True)