def test_plain_code_challenge_success(self):
    self.prepare_data()
    url = (self.authorize_url + '&code_challenge=foo')
    rv = self.client.post(url, data={'user_id': '1'})
    self.assertIn('code=', rv.location)
    params = dict(url_decode(urlparse.urlparse(rv.location).query))
    code = params['code']
    rv = self.client.post('/oauth/token', data={'grant_type': 'authorization_code', 'code': code, 'code_verifier': 'foo', 'client_id': 'code-client'})
    resp = json.loads(rv.data)
    self.assertIn('access_token', resp)
def test_plain_code_challenge_success(self):
    self.prepare_data()
    url = (self.authorize_url + '&code_challenge=foo')
    rv = self.client.post(url, data={'user_id': '1'})
    self.assertIn('code=', rv.location)
    params = dict(url_decode(urlparse.urlparse(rv.location).query))
    code = params['code']
    rv = self.client.post('/oauth/token', data={'grant_type': 'authorization_code', 'code': code, 'code_verifier': 'foo', 'client_id': 'code-client'})
    resp = json.loads(rv.data)
    self.assertIn('access_token', resp)