/
githubmirror
/
salt
Обзор
Документация
Войти
/
githubmirror
/
salt
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tests/pytests/functional/utils/user/test__getgrall.py
44 строки
987 B
nicholasmhughes
remove permission check as its probably an unreachable edge case
21 сен 2023, 20:40
21 сен 2023, 20:40
8fbb5d3
Код
Авторство
О чём код?
from textwrap import dedent import pytest pytest.importorskip("grp") import grp import salt.utils.user @pytest.fixture(scope="function") def etc_group(tmp_path): etcgrp = tmp_path / "etc" / "group" etcgrp.parent.mkdir() etcgrp.write_text( dedent( """games:x:50: docker:x:959:debian,salt salt:x:1000:""" ) ) return etcgrp def test__getgrall(etc_group): group_lines = [ ["games", "x", 50, []], ["docker", "x", 959, ["debian", "salt"]], ["salt", "x", 1000, []], ] expected_grall = [grp.struct_group(comps) for comps in group_lines] grall = salt.utils.user._getgrall(root=str(etc_group.parent.parent)) assert grall == expected_grall def test__getgrall_bad_format(etc_group): with etc_group.open("a") as _fp: _fp.write("\n# some comment here\n") with pytest.raises(IndexError): salt.utils.user._getgrall(root=str(etc_group.parent.parent))