def test_deprecated_methods(): cfg = Config() cfg.Authenticator.whitelist = {'user'} authenticator = auth.Authenticator(config=cfg) assert authenticator.check_allowed("user") with pytest.deprecated_call(): assert authenticator.check_whitelist("user") assert not authenticator.check_allowed("otheruser") with pytest.deprecated_call(): assert not authenticator.check_whitelist("otheruser")
def test_deprecated_config(caplog): cfg = Config() cfg.Authenticator.whitelist = {'user'} log = logging.getLogger("testlog") authenticator = auth.Authenticator(config=cfg, log=log) assert caplog.record_tuples == [( log.name, logging.WARNING, 'Authenticator.whitelist is deprecated in JupyterHub 1.2, use ' 'Authenticator.allowed_users instead', )] assert authenticator.allowed_users == {'user'}