mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-15 22:13:00 +00:00
delay evaluation of oauth environment variables
only affects mocking in tests
This commit is contained in:
@@ -405,18 +405,25 @@ class HubOAuth(HubAuth):
|
||||
|
||||
# HubOAuth API
|
||||
|
||||
oauth_client_id = Unicode(os.getenv('JUPYTERHUB_CLIENT_ID', ''),
|
||||
oauth_client_id = Unicode(
|
||||
help="""The OAuth client ID for this application.
|
||||
|
||||
Use JUPYTERHUB_CLIENT_ID by default.
|
||||
"""
|
||||
).tag(config=True)
|
||||
oauth_client_secret = Unicode(os.getenv('JUPYTERHUB_CLIENT_SECRET', ''),
|
||||
@default('oauth_client_id')
|
||||
def _client_id(self):
|
||||
return os.getenv('JUPYTERHUB_CLIENT_ID', '')
|
||||
|
||||
oauth_client_secret = Unicode(
|
||||
help="""The OAuth client secret for this application.
|
||||
|
||||
Use JUPYTERHUB_CLIENT_SECRET by default.
|
||||
"""
|
||||
).tag(config=True)
|
||||
@default('oauth_client_secret')
|
||||
def _client_secret(self):
|
||||
return os.getenv('JUPYTERHUB_CLIENT_SECRET', '')
|
||||
|
||||
oauth_redirect_uri = Unicode(
|
||||
help="""OAuth redirect URI
|
||||
|
@@ -254,6 +254,8 @@ class StubSingleUserSpawner(MockSpawner):
|
||||
with mock.patch.dict(os.environ, env):
|
||||
app = self._app = MockSingleUserServer()
|
||||
app.initialize(args)
|
||||
assert app.hub_auth.oauth_client_id
|
||||
assert app.hub_auth.oauth_client_secret
|
||||
app.start()
|
||||
|
||||
self._thread = threading.Thread(target=_run)
|
||||
|
Reference in New Issue
Block a user