Beispiel #1
0
def test_mod_user(user_setup) -> None:
    binary_manager = BinaryManager()
    user_helper = UserHelper(binary_manager.binary(Binaries.USERADD),
                             binary_manager.binary(Binaries.USERMOD))
    user_helper.usermod('test', comment='freshly added user',
                        shell='/usr/bin/nologin', root_directory=user_setup)

    result = UserHelper.user_data('test', root_directory=user_setup)
    assert result
    assert result._asdict() == {'name': 'test', 'password': '******',
                                'uid': 10001, 'gid': 10001, 'comment': 'freshly added user',
                                'home': '/home/test', 'shell': '/usr/bin/nologin'}
Beispiel #2
0
def test_mod_user(user_setup) -> None:
    binary_manager = BinaryManager()
    user_helper = UserHelper(binary_manager.binary(Binaries.USERADD),
                             binary_manager.binary(Binaries.USERMOD))
    user_helper.usermod(
        "test",
        comment="freshly added user",
        shell="/usr/bin/nologin",
        root_directory=user_setup,
    )

    result = UserHelper.user_data("test", root_directory=user_setup)
    assert result
    assert result._asdict() == {
        "name": "test",
        "password": "******",
        "uid": 10001,
        "gid": 10001,
        "comment": "freshly added user",
        "home": "/home/test",
        "shell": "/usr/bin/nologin",
    }