'Verify we can get assertions via the badge class and username.'

@unpack
@data((False, False), (True, False), (True, True))
def test_get_assertions(self, check_course, wildcard):

    badge_class = self.create_badge_class(check_course)
    for dummy in range(3):
        BadgeAssertionFactory.create(user=self.user, badge_class=badge_class)
    if badge_class.course_id:
        alt_class = BadgeClassFactory.create(slug=badge_class.slug, issuing_component=badge_class.issuing_component, course_id=CourseFactory.create().location.course_key)
        BadgeAssertionFactory.create(user=self.user, badge_class=alt_class)
    for dummy in range(5):
        BadgeAssertionFactory.create(badge_class=badge_class)
    for dummy in range(6):
        BadgeAssertionFactory.create()
    response = self.get_json(self.url(), data=self.get_qs_args(check_course, wildcard, badge_class))
    if wildcard:
        expected_length = 4
    else:
        expected_length = 3
    self.assertEqual(len(response['results']), expected_length)
    unused_class = self.create_badge_class(check_course, slug='unused_slug', issuing_component='unused_component')
    response = self.get_json(self.url(), data=self.get_qs_args(check_course, wildcard, unused_class))
    self.assertEqual(len(response['results']), 0)
