mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-07 18:14:10 +00:00
Clear the auth cache when testing the same url twice with different results
This commit is contained in:
@@ -99,6 +99,11 @@ class _ExpiringDict(dict):
|
||||
except KeyError:
|
||||
return default
|
||||
|
||||
def clear(self):
|
||||
"""Clear the cache"""
|
||||
self.values.clear()
|
||||
self.timestamps.clear()
|
||||
|
||||
|
||||
class HubAuth(SingletonConfigurable):
|
||||
"""A class for authenticating with JupyterHub
|
||||
|
@@ -170,6 +170,10 @@ def test_hub_authenticated(request):
|
||||
assert r.status_code == 302
|
||||
assert auth.login_url in r.headers['Location']
|
||||
|
||||
# clear the cache because we are going to request
|
||||
# the same url again with a different result
|
||||
auth.cache.clear()
|
||||
|
||||
# upstream 403
|
||||
m.get(bad_url, status_code=403)
|
||||
r = requests.get('http://127.0.0.1:%i' % port,
|
||||
|
Reference in New Issue
Block a user