'Verify correct parameter parsing and validation for auth code responses.'

def test_grant_response(self):

    params = parse_authorization_code_response(self.grant_response)
    self.assertEqual(params, self.grant_dict)
    params = parse_authorization_code_response(self.grant_response, state=self.state)
    self.assertEqual(params, self.grant_dict)
    self.assertRaises(MissingCodeError, parse_authorization_code_response, self.error_nocode)
    self.assertRaises(MissingCodeError, parse_authorization_code_response, self.error_response)
    self.assertRaises(MismatchingStateError, parse_authorization_code_response, self.error_nostate, state=self.state)
    self.assertRaises(MismatchingStateError, parse_authorization_code_response, self.error_wrongstate, state=self.state)
