'Make sure the proper badges are awarded when groups are completed.'

def test_group_matches(self):

    user = UserFactory()
    items = list(self.config_map.items())
    for (badge_class, course_keys) in items:
        for (i, key) in enumerate(course_keys):
            GeneratedCertificate(user=user, course_id=key, status=CertificateStatuses.downloadable).save()
            if ((i + 1) == len(course_keys)):
                self.assertTrue(badge_class.get_for_user(user))
            else:
                self.assertFalse(badge_class.get_for_user(user))
    classes = [badge.badge_class.id for badge in user.badgeassertion_set.all()]
    source_classes = [badge.id for badge in self.badge_classes]
    self.assertEqual(classes, source_classes)
