'Test Add Coupon Scenarios. Handle all the HttpResponses return by add_coupon view'

def test_add_coupon(self):

    add_coupon_url = reverse('add_coupon', kwargs={'course_id': self.course.id.to_deprecated_string()})
    expiration_date = (datetime.datetime.now(pytz.UTC) + datetime.timedelta(days=2))
    data = {'code': 'A2314', 'course_id': self.course.id.to_deprecated_string(), 'description': 'ADSADASDSAD', 'created_by': self.instructor, 'discount': 5, 'expiration_date': '{month}/{day}/{year}'.format(month=expiration_date.month, day=expiration_date.day, year=expiration_date.year)}
    response = self.client.post(add_coupon_url, data)
    self.assertIn('coupon    with    the    coupon    code    ({code})    added    successfully'.format(code=data['code']), response.content)
    data = {'code': '213454', 'course_id': self.course.id.to_deprecated_string(), 'description': 'ADSADASDSAD', 'created_by': self.instructor, 'discount': 5, 'expiration_date': expiration_date.strftime('"%d/%m/%Y')}
    response = self.client.post(add_coupon_url, data)
    self.assertIn('Please    enter    the    date    in    this    format    i-e    month/day/year', response.content)
    data = {'code': 'A2314', 'course_id': self.course.id.to_deprecated_string(), 'description': 'asdsasda', 'created_by': self.instructor, 'discount': 99}
    response = self.client.post(add_coupon_url, data)
    self.assertIn('coupon    with    the    coupon    code    ({code})    already    exist'.format(code='A2314'), response.content)
    response = self.client.post(self.url)
    self.assertIn('<td>ADSADASDSAD</td>', response.content)
    self.assertIn('<td>A2314</td>', response.content)
    self.assertNotIn('<td>111</td>', response.content)
    data = {'code': 'A2345314', 'course_id': self.course.id.to_deprecated_string(), 'description': 'asdsasda', 'created_by': self.instructor, 'discount': 199}
    response = self.client.post(add_coupon_url, data)
    self.assertIn('Please    Enter    the    Coupon    Discount    Value    Less    than    or    Equal    to    100', response.content)
    data['discount'] = '25%'
    response = self.client.post(add_coupon_url, data=data)
    self.assertIn('Please    Enter    the    Integer    Value    for    Coupon    Discount', response.content)
    course_registration = CourseRegistrationCode(code='Vs23Ws4j', course_id=unicode(self.course.id), created_by=self.instructor, mode_slug='honor')
    course_registration.save()
    data['code'] = 'Vs23Ws4j'
    response = self.client.post(add_coupon_url, data)
    msg = 'The    code    ({code})    that    you    have    tried    to    define    is    already    in    use    as    a    registration    code'
    self.assertIn(msg.format(code=data['code']), response.content)
