mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-13 04:53:01 +00:00
avoid cleaning users when we are testing resume
This commit is contained in:
@@ -40,7 +40,7 @@ from tornado import gen
|
|||||||
from tornado.concurrent import Future
|
from tornado.concurrent import Future
|
||||||
from tornado.ioloop import IOLoop
|
from tornado.ioloop import IOLoop
|
||||||
|
|
||||||
from traitlets import default
|
from traitlets import Bool, default
|
||||||
|
|
||||||
from ..app import JupyterHub
|
from ..app import JupyterHub
|
||||||
from ..auth import PAMAuthenticator
|
from ..auth import PAMAuthenticator
|
||||||
@@ -282,12 +282,15 @@ class MockHub(JupyterHub):
|
|||||||
self.db.expire(service)
|
self.db.expire(service)
|
||||||
return super().init_services()
|
return super().init_services()
|
||||||
|
|
||||||
|
clean_users = Bool(True)
|
||||||
|
|
||||||
def init_db(self):
|
def init_db(self):
|
||||||
"""Ensure we start with a clean user list"""
|
"""Ensure we start with a clean user list"""
|
||||||
super().init_db()
|
super().init_db()
|
||||||
for user in self.db.query(orm.User):
|
if self.clean_users:
|
||||||
self.db.delete(user)
|
for user in self.db.query(orm.User):
|
||||||
self.db.commit()
|
self.db.delete(user)
|
||||||
|
self.db.commit()
|
||||||
|
|
||||||
@gen.coroutine
|
@gen.coroutine
|
||||||
def initialize(self, argv=None):
|
def initialize(self, argv=None):
|
||||||
|
@@ -206,7 +206,7 @@ def test_resume_spawners(tmpdir, request):
|
|||||||
ssl_enabled = getattr(request.module, "ssl_enabled", False)
|
ssl_enabled = getattr(request.module, "ssl_enabled", False)
|
||||||
if ssl_enabled:
|
if ssl_enabled:
|
||||||
kwargs['internal_certs_location'] = str(tmpdir)
|
kwargs['internal_certs_location'] = str(tmpdir)
|
||||||
app = MockHub(**kwargs)
|
app = MockHub(clean_users=False, **kwargs)
|
||||||
app.config.ConfigurableHTTPProxy.should_start = False
|
app.config.ConfigurableHTTPProxy.should_start = False
|
||||||
app.config.ConfigurableHTTPProxy.auth_token = 'unused'
|
app.config.ConfigurableHTTPProxy.auth_token = 'unused'
|
||||||
yield app.initialize([])
|
yield app.initialize([])
|
||||||
|
Reference in New Issue
Block a user