'test filter out the registration codes
that were generated via Invoice.'

def test_invoice_generated_registration_codes(self):

    invoice_item = CourseRegistrationCodeInvoiceItem.objects.create(invoice=self.invoice, qty=5, unit_price='123.45', course_id=self.course_key)
    for i in range(5):
        CourseRegistrationCode.objects.create(code='testcode{counter}'.format(counter=i), course_id=self.course_key, created_by=self.user, invoice=self.invoice, invoice_item=invoice_item, mode_slug='honor')
    registration_codes = CourseRegistrationCode.invoice_generated_registration_codes(self.course_key)
    self.assertEqual(registration_codes.count(), 5)
