def METHOD_NAME(self):
    server = self.create_server()
    self.prepare_data()
    request = self.factory.post(
        '/oauth/token',
        data={'grant_type': 'password', 'username': 'foo', 'password': 'ok'},
    )
    resp = server.create_token_response(request)
    self.assertEqual(resp.status_code, 401)
    data = json.loads(resp.content)
    self.assertEqual(data['error'], 'invalid_client')
    request = self.factory.post(
        '/oauth/token',
        data={'grant_type': 'password', 'username': 'foo', 'password': 'ok'},
        HTTP_AUTHORIZATION=self.create_basic_auth('invalid', 'secret'),
    )
    resp = server.create_token_response(request)
    self.assertEqual(resp.status_code, 401)
    data = json.loads(resp.content)
    self.assertEqual(data['error'], 'invalid_client')