diff --git a/stages/test/test_users.py b/stages/test/test_users.py index c74cbe55..53a797a8 100644 --- a/stages/test/test_users.py +++ b/stages/test/test_users.py @@ -82,3 +82,25 @@ def test_users_mock_bin(tmp_path, stage_module, user_opts, expected_args): stage_module.main(tmp_path, options) assert len(mocked_chroot.call_args_list) == 1 assert mocked_chroot.call_args_list[0][2:] == expected_args + ["foo"] + + +# separate test right now as it results in two binaries being called +# (adduser,passwd) which our parameter tests cannot do yet +def test_users_with_expire_date(tmp_path, stage_module): + with mock_command("chroot", "") as mocked_chroot: + make_fake_tree(tmp_path, { + "/etc/passwd": "", + }) + + options = { + "users": { + "foo": { + "force_password_reset": True, + }, + } + } + + stage_module.main(tmp_path, options) + assert len(mocked_chroot.call_args_list) == 2 + assert mocked_chroot.call_args_list[0][1:] == ["useradd", "foo"] + assert mocked_chroot.call_args_list[1][1:] == ["passwd", "--expire", "foo"]