Always use urljoin to construct Blender ID URLs
This commit is contained in:
@@ -220,7 +220,7 @@ def fetch_blenderid_user() -> dict:
|
||||
|
||||
my_log = log.getChild('fetch_blenderid_user')
|
||||
|
||||
bid_url = '%s/api/user' % current_app.config['BLENDER_ID_ENDPOINT']
|
||||
bid_url = urljoin(current_app.config['BLENDER_ID_ENDPOINT'], 'api/user')
|
||||
my_log.debug('Fetching user info from %s', bid_url)
|
||||
|
||||
credentials = current_app.config['OAUTH_CREDENTIALS']['blender-id']
|
||||
|
@@ -140,7 +140,7 @@ class BlenderIdSignIn(OAuthSignIn):
|
||||
client_secret=self.consumer_secret,
|
||||
authorize_url=urljoin(base_url, 'oauth/authorize'),
|
||||
access_token_url=urljoin(base_url, 'oauth/token'),
|
||||
base_url='%s/api/' % base_url
|
||||
base_url=urljoin(base_url, 'api/'),
|
||||
)
|
||||
|
||||
def authorize(self):
|
||||
|
@@ -11,11 +11,7 @@ import pathlib
|
||||
import sys
|
||||
import typing
|
||||
import unittest.mock
|
||||
|
||||
try:
|
||||
from urllib.parse import urlencode
|
||||
except ImportError:
|
||||
from urllib.parse import urlencode
|
||||
from urllib.parse import urlencode, urljoin
|
||||
|
||||
from bson import ObjectId, tz_util
|
||||
|
||||
@@ -433,7 +429,7 @@ class AbstractPillarTest(TestMinimal):
|
||||
"""Sets up Responses to mock unhappy validation flow."""
|
||||
|
||||
responses.add(responses.POST,
|
||||
'%s/u/validate_token' % self.app.config['BLENDER_ID_ENDPOINT'],
|
||||
urljoin(self.app.config['BLENDER_ID_ENDPOINT'], 'u/validate_token'),
|
||||
json={'status': 'fail'},
|
||||
status=403)
|
||||
|
||||
@@ -441,7 +437,7 @@ class AbstractPillarTest(TestMinimal):
|
||||
"""Sets up Responses to mock happy validation flow."""
|
||||
|
||||
responses.add(responses.POST,
|
||||
'%s/u/validate_token' % self.app.config['BLENDER_ID_ENDPOINT'],
|
||||
urljoin(self.app.config['BLENDER_ID_ENDPOINT'], 'u/validate_token'),
|
||||
json=BLENDER_ID_USER_RESPONSE,
|
||||
status=200)
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
"""Flask configuration file for unit testing."""
|
||||
|
||||
BLENDER_ID_ENDPOINT = 'http://id.local:8001' # Non existant server
|
||||
BLENDER_ID_ENDPOINT = 'http://id.local:8001/' # Non existant server
|
||||
|
||||
SERVER_NAME = 'localhost.local'
|
||||
PILLAR_SERVER_ENDPOINT = 'http://localhost.local/api/'
|
||||
|
Reference in New Issue
Block a user