mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Merge pull request #399 from GeorgianaElena/add_append_to_arg
Allow adding multiple admins during install
This commit is contained in:
@@ -4,6 +4,7 @@ Unit test functions in installer.py
|
||||
import os
|
||||
|
||||
from tljh import installer
|
||||
from tljh.yaml import yaml
|
||||
|
||||
|
||||
def test_ensure_node():
|
||||
@@ -19,3 +20,16 @@ def test_ensure_config_yaml(tljh_dir):
|
||||
assert os.path.isdir(os.path.join(installer.CONFIG_DIR, 'jupyterhub_config.d'))
|
||||
# verify that old config doesn't exist
|
||||
assert not os.path.exists(os.path.join(tljh_dir, 'config.yaml'))
|
||||
|
||||
def test_ensure_admins(tljh_dir):
|
||||
# --admin option called multiple times on the installer
|
||||
# creates a list of argument lists.
|
||||
admins = [['a1'], ['a2'], ['a3']]
|
||||
installer.ensure_admins(admins)
|
||||
|
||||
config_path = installer.CONFIG_FILE
|
||||
with open(config_path, 'r') as f:
|
||||
config = yaml.load(f)
|
||||
|
||||
# verify the list was flattened
|
||||
assert config['users']['admin'] == ['a1', 'a2', 'a3']
|
||||
|
||||
Reference in New Issue
Block a user