1bundle common test_meta
2{
3  vars:
4      "description" string => "A user not present gets added with password";
5      "story_id" string => "5525";
6      "covers" string => "operational_repaired";
7}
8
9#######################################################
10
11body common control
12{
13      inputs => { "../../default.cf.sub", "user_queries.cf.sub" };
14      bundlesequence  => { default("$(this.promise_filename)") };
15}
16
17#######################################################
18
19bundle common hpux_trusted
20{
21  classes:
22      "hpux_trusted_mode_test"
23        expression => regcmp(".*hpux_trusted.*", $(this.promise_filename));
24}
25
26bundle agent init
27{
28  meta:
29      "test_skip_unsupported" string => "hpux_trusted_mode_test.!hpux";
30
31  # Remove him first, should he already be present.
32  users:
33    "johndoe"
34      policy => "absent";
35}
36
37#######################################################
38
39bundle agent test
40{
41  users:
42    "johndoe"
43      policy => "present",
44      password => test_password;
45}
46
47body password test_password
48{
49  format => "plaintext";
50  data => "J0hnd0eX";
51}
52
53#######################################################
54
55bundle agent check
56{
57  methods:
58    !windows::
59      "any" usebundle => user_get_password_hash("johndoe"),
60        classes => always("methods_run");
61    windows::
62      "any" usebundle => user_has_password("johndoe", "J0hnd0eX", "pw_ok", "pw_fail"),
63        classes => always("methods_run");
64
65    any::
66      "any" usebundle => user_does_not_need_password_update("johndoe", "no_pw_update_ok", "no_pw_update_fail");
67
68  classes:
69      "ready" expression => "methods_run";
70    !windows::
71      # Make sure the password field has grown to more than a few characters.
72      "pw_ok" expression => regcmp("^[^:][^:][^:][^:][^:][^:][^:][^:][^:][^:].*", "$(user_get_password_hash.hash)");
73
74    any::
75      "ok" and => { "pw_ok", "!pw_fail", "no_pw_update_ok", "!no_pw_update_fail" };
76
77  reports:
78    ok.ready::
79      "$(this.promise_filename) Pass";
80    !ok.ready::
81      "$(this.promise_filename) FAIL";
82}
83