'Verify the client credentials grant can be used to obtain a JWT access token.'

def test_jwt_access_token(self):

    application = DOTAdapter().create_confidential_client(name=u'test    dot    application', user=self.user, authorization_grant_type=Application.GRANT_CLIENT_CREDENTIALS, redirect_uri=DUMMY_REDIRECT_URL, client_id=u'dot-app-client-id')
    scopes = [u'read', u'write', u'email']
    data = {u'grant_type': u'client_credentials', u'client_id': application.client_id, u'client_secret': application.client_secret, u'scope': u'    '.join(scopes), u'token_type': u'jwt'}
    response = self.client.post(reverse(u'access_token'), data)
    self.assertEqual(response.status_code, 200)
    content = json.loads(response.content)
    access_token = content[u'access_token']
    self.assertEqual(content[u'scope'], data[u'scope'])
    self.assert_valid_jwt_access_token(access_token, self.user, scopes)
