def test_give(session): username = random_name() run_commander('add user {}'.format(username)) package_name = random_name() run_commander('add package {}'.format(package_name)) exit_code = run_commander('give {} write {}'.format( username, package_name)) assert exit_code == 1
def test_add_package_in_package(session): name1 = random_name() name2 = random_name() exit_code1 = run_commander('add package {}'.format(name1)) exit_code2 = run_commander('add package {} --in {}'.format(name2, name1)) assert exit_code1 == 1 assert exit_code2 == 1 package = session.get_by_id('sys_md_Package', name2, expand=['parent']) assert package['parent']['id'] == name1
def test_add_package(session): name = random_name() exit_code = run_commander('add package {}'.format(name)) assert exit_code == 1 package = session.get_by_id('sys_md_Package', name) assert 'parent' not in package
def test_add_token(session): token = random_name() exit_code = run_commander('add token admin {}'.format(token)) assert exit_code == 1 result = session.get('sys_sec_Token', q=_token_by_token_query(token), expand=['user']) assert len(result) == 1 token = result[0] assert token['User']['username'] == 'admin'
def test_add_user_inactive(session): name = random_name() exit_code = run_commander('add user {} --is-inactive'.format(name)) assert exit_code == 1 assert _user_can_login(name, name) is False result = session.get('sys_sec_User', q=_user_by_name_query(name)) assert len(result) == 1 user = result[0] assert user['Email'] == '{}@molgenis.org'.format(name) assert user['active'] is False assert user['superuser'] is False assert user['changePassword'] is False
def test_add_user_email(session): name = random_name() exit_code = run_commander('add user {} --with-email {}@test.nl'.format( name, name)) assert exit_code == 1 assert _user_can_login(name, name) result = session.get('sys_sec_User', q=_user_by_name_query(name)) assert len(result) == 1 user = result[0] assert user['Email'] == '{}@test.nl'.format(name) assert user['active'] is True assert user['superuser'] is False assert user['changePassword'] is False
def test_add_user_set_password(session): name = random_name() password = '******' exit_code = run_commander('add user {} --set-password {}'.format( name, password)) assert exit_code == 1 assert _user_can_login(name, password) result = session.get('sys_sec_User', q=_user_by_name_query(name)) assert len(result) == 1 user = result[0] assert user['Email'] == '{}@molgenis.org'.format(name) assert user['active'] is True assert user['superuser'] is False assert user['changePassword'] is False
def _random_group_name(): return '{}-{}'.format(random_name(), random_name())