'test to mark the already unredeemed registration code as unredeemed.'

def test_returns_error_when_unredeeming_already_unredeemed_registration_code_redemption(self):

    for i in range(2):
        CourseRegistrationCode.objects.create(code='reg_code{}'.format(i), course_id=self.course.id.to_deprecated_string(), created_by=self.instructor, invoice=self.sale_invoice, invoice_item=self.invoice_item, mode_slug=CourseMode.DEFAULT_MODE_SLUG)
    reg_code = CourseRegistrationCode.objects.all()[0]
    data = {'registration_code': reg_code.code, 'action_type': 'unredeem_registration_code'}
    response = self.client.post(self.registration_code_detail_url, data)
    self.assertEqual(response.status_code, 400)
    json_dict = json.loads(response.content)
    message = _('The    redemption    does    not    exist    against    enrollment    code    ({code}).').format(code=reg_code.code)
    self.assertEqual(message, json_dict['message'])
