mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 02:04:04 +08:00
FIx py3 compat and add unit test
This commit is contained in:
@@ -3,13 +3,13 @@ import hashlib
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
from urllib import quote
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import jwt
|
||||
import requests
|
||||
from oauthlib.common import generate_nonce
|
||||
from requests_oauthlib import OAuth2Session
|
||||
from six.moves.urllib.parse import quote
|
||||
|
||||
from galaxy import util
|
||||
from galaxy.model import CustosAuthnzToken, User
|
||||
@@ -29,7 +29,6 @@ class CustosAuthnz(IdentityProvider):
|
||||
self.config['client_secret'] = oidc_backend_config['client_secret']
|
||||
self.config['redirect_uri'] = oidc_backend_config['redirect_uri']
|
||||
self.config['ca_bundle'] = oidc_backend_config.get('ca_bundle', None)
|
||||
self.config['enable_idp_logout'] = oidc_backend_config['enable_idp_logout']
|
||||
self.config['extra_params'] = {
|
||||
'kc_idp_hint': oidc_backend_config.get('idphint', 'cilogon')
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ from datetime import datetime, timedelta
|
||||
|
||||
import jwt
|
||||
import requests
|
||||
from six.moves.urllib.parse import parse_qs, urlparse
|
||||
from six.moves.urllib.parse import parse_qs, quote, urlparse
|
||||
|
||||
from galaxy.authnz import custos_authnz
|
||||
from galaxy.model import CustosAuthnzToken, User
|
||||
@@ -32,7 +32,8 @@ class CustosAuthnzTestCase(unittest.TestCase):
|
||||
requests.get = self.mockRequest(self._get_idp_url(), {
|
||||
"authorization_endpoint": "https://test-auth-endpoint",
|
||||
"token_endpoint": "https://test-token-endpoint",
|
||||
"userinfo_endpoint": "https://test-userinfo-endpoint"
|
||||
"userinfo_endpoint": "https://test-userinfo-endpoint",
|
||||
"end_session_endpoint": "https://test-end-session-endpoint"
|
||||
})
|
||||
self.custos_authnz = custos_authnz.CustosAuthnz('Custos', {
|
||||
'VERIFY_SSL': True
|
||||
@@ -474,3 +475,10 @@ class CustosAuthnzTestCase(unittest.TestCase):
|
||||
self.assertFalse(success)
|
||||
self.assertNotEqual("", message)
|
||||
self.assertIsNone(redirect_uri)
|
||||
|
||||
def test_logout_with_redirect(self):
|
||||
|
||||
logout_redirect_url = "http://localhost:8080/post-logout"
|
||||
redirect_url = self.custos_authnz.logout(self.trans, logout_redirect_url)
|
||||
|
||||
self.assertEqual(redirect_url, "https://test-end-session-endpoint?redirect_uri=" + quote(logout_redirect_url))
|
||||
|
||||
Reference in New Issue
Block a user