def METHOD_NAME(self):
    """Test token creation endpoint"""
    response = self.client.post(
        reverse("authentik_api:token-list"), {"identifier": "test-token"}
    )
    self.assertEqual(response.status_code, 201)
    token = Token.objects.get(identifier="test-token")
    self.assertEqual(token.user, self.user)
    self.assertEqual(token.intent, TokenIntents.INTENT_API)
    self.assertEqual(token.expiring, True)
    self.assertTrue(self.user.has_perm("authentik_core.view_token_key", token))
    self.client.force_login(self.admin)
    new_key = generate_id()
    response = self.client.post(
        reverse("authentik_api:token-set-key", kwargs={"identifier": token.identifier}),
        {"key": new_key},
    )
    self.assertEqual(response.status_code, 204)
    token.refresh_from_db()
    self.assertEqual(token.key, new_key)