avoid cleaning users when we are testing resume

This commit is contained in:
Min RK
2018-10-17 11:02:06 +02:00
parent 301fed30b2
commit b0116ee539
2 changed files with 8 additions and 5 deletions

View File

@@ -40,7 +40,7 @@ from tornado import gen
from tornado.concurrent import Future
from tornado.ioloop import IOLoop
from traitlets import default
from traitlets import Bool, default
from ..app import JupyterHub
from ..auth import PAMAuthenticator
@@ -282,12 +282,15 @@ class MockHub(JupyterHub):
self.db.expire(service)
return super().init_services()
clean_users = Bool(True)
def init_db(self):
"""Ensure we start with a clean user list"""
super().init_db()
for user in self.db.query(orm.User):
self.db.delete(user)
self.db.commit()
if self.clean_users:
for user in self.db.query(orm.User):
self.db.delete(user)
self.db.commit()
@gen.coroutine
def initialize(self, argv=None):

View File

@@ -206,7 +206,7 @@ def test_resume_spawners(tmpdir, request):
ssl_enabled = getattr(request.module, "ssl_enabled", False)
if ssl_enabled:
kwargs['internal_certs_location'] = str(tmpdir)
app = MockHub(**kwargs)
app = MockHub(clean_users=False, **kwargs)
app.config.ConfigurableHTTPProxy.should_start = False
app.config.ConfigurableHTTPProxy.auth_token = 'unused'
yield app.initialize([])