def METHOD_NAME(self):
    """
    Make sure the proper badges are awarded when groups are completed.
    """
    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()
            # We don't award badges until all three are set.
            if i + 1 == len(course_keys):
                assert badge_class.get_for_user(user)
            else:
                assert not 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]
    assert classes == source_classes