'Verify the client credentials grant can be used to obtain an access token whose default scopes allow access
to the user info endpoint.'

def test_access_token(self):

    oauth_client = ClientFactory(user=self.user)
    data = {u'grant_type': u'client_credentials', u'client_id': oauth_client.client_id, u'client_secret': oauth_client.client_secret}
    response = self.client.post(reverse(u'oauth2:access_token'), data)
    self.assertEqual(response.status_code, 200)
    access_token = json.loads(response.content)[u'access_token']
    expected = AccessToken.objects.filter(client=oauth_client, user=self.user).first().token
    self.assertEqual(access_token, expected)
    headers = {u'HTTP_AUTHORIZATION': (u'Bearer    ' + access_token)}
    response = self.client.get(reverse(u'oauth2:user_info'), **headers)
    self.assertEqual(response.status_code, 200)
