'Verify the endpoint can create a new credit request.'

def test_post_with_provider_integration(self):

    username = self.user.username
    course = self.eligibility.course
    course_key = course.course_key
    final_grade = 0.95
    self.provider.enable_integration = True
    self.provider.save()
    requirement = CreditRequirement.objects.create(course=course, namespace=u'grade', name=u'grade')
    CreditRequirementStatus.objects.create(username=username, requirement=requirement, status=u'satisfied', reason={u'final_grade': final_grade})
    secret_key = u'secret'
    with override_settings(CREDIT_PROVIDER_SECRET_KEYS={self.provider.provider_id: secret_key}):
        response = self.post_credit_request(username, course_key)
    self.assertEqual(response.status_code, 200)
    request = CreditRequest.objects.get(username=username, course__course_key=course_key)
    self.assertEqual(request.status, u'pending')
    content = json.loads(response.content)
    parameters = content[u'parameters']
    self.assertEqual(content[u'url'], self.provider.provider_url)
    self.assertEqual(content[u'method'], u'POST')
    self.assertEqual(len(parameters[u'request_uuid']), 32)
    self.assertEqual(parameters[u'course_org'], course_key.org)
    self.assertEqual(parameters[u'course_num'], course_key.course)
    self.assertEqual(parameters[u'course_run'], course_key.run)
    self.assertEqual(parameters[u'final_grade'], unicode(final_grade))
    self.assertEqual(parameters[u'user_username'], username)
    self.assertEqual(parameters[u'user_full_name'], self.user.get_full_name())
    self.assertEqual(parameters[u'user_mailing_address'], u'')
    self.assertEqual(parameters[u'user_country'], u'')
    self.assertEqual(parameters[u'signature'], signature(parameters, secret_key))
