'Test certificates exception addition api endpoint in scenario when same
student is added to two different courses.'

def test_certificate_exception_same_user_in_two_different_courses(self):

    response = self.client.post(self.url, data=json.dumps(self.certificate_exception), content_type='application/json')
    self.assertEqual(response.status_code, 200)
    certificate_exception = json.loads(response.content)
    self.assertEqual(certificate_exception['user_email'], self.user.email)
    self.assertEqual(certificate_exception['user_name'], self.user.username)
    self.assertEqual(certificate_exception['user_id'], self.user.id)
    course2 = CourseFactory.create()
    url_course2 = reverse('certificate_exception_view', kwargs={'course_id': unicode(course2.id)})
    self.client.post(url_course2, data=json.dumps(self.certificate_exception), content_type='application/json')
    self.assertEqual(response.status_code, 200)
    certificate_exception = json.loads(response.content)
    self.assertEqual(certificate_exception['user_email'], self.user.email)
    self.assertEqual(certificate_exception['user_name'], self.user.username)
    self.assertEqual(certificate_exception['user_id'], self.user.id)
