3 Provides unit tests and examples for the <Access> lens.
9 A full configuration *)
10 let conf = "+ : ALL : LOCAL
11 + : root : localhost.localdomain
12 - : root : 127.0.0.1 .localdomain
13 + : root alice@server1 @admins (wheel) : cron crond :0 tty1 tty2 tty3 tty4 tty5 tty6
15 + : john foo : 2001:4ca0:0:101::1 2001:4ca0:0:101::/64
17 + : ALL EXCEPT john @wheel : ALL EXCEPT LOCAL .win.tue.nl
23 Test the full <conf> *)
24 test Access.lns get conf =
27 { "origin" = "LOCAL" } }
30 { "origin" = "localhost.localdomain" } }
33 { "origin" = "127.0.0.1" }
34 { "origin" = ".localdomain" } }
38 { "host" = "server1" } }
39 { "netgroup" = "admins" }
42 { "origin" = "crond" }
49 { "origin" = "tty6" } }
50 { "#comment" = "IP v6 support" }
54 { "origin" = "2001:4ca0:0:101::1" }
55 { "origin" = "2001:4ca0:0:101::/64" } }
56 { "#comment" = "Except" }
61 { "netgroup" = "wheel" } }
64 { "origin" = "LOCAL" }
65 { "origin" = ".win.tue.nl" } } }
66 { "#comment" = "No spaces" }
69 { "origin" = ".example.com" } }
71 test Access.lns put conf after
72 insa "access" "access[last()]" ;
73 set "access[last()]" "-" ;
74 set "access[last()]/user" "ALL" ;
75 set "access[last()]/origin" "ALL"
77 + : root : localhost.localdomain
78 - : root : 127.0.0.1 .localdomain
79 + : root alice@server1 @admins (wheel) : cron crond :0 tty1 tty2 tty3 tty4 tty5 tty6
81 + : john foo : 2001:4ca0:0:101::1 2001:4ca0:0:101::/64
83 + : ALL EXCEPT john @wheel : ALL EXCEPT LOCAL .win.tue.nl
90 - netgroups (starting with '@') are mapped as "netgroup" nodes;
91 - nisdomains (starting with '@@') are mapped as "nisdomain" nodes.
93 This closes <ticket #190 at https://fedorahosted.org/augeas/ticket/190>.
95 test Access.lns get "+ : @group@@domain : ALL \n" =
97 { "netgroup" = "group"
98 { "nisdomain" = "domain" } }
99 { "origin" = "ALL" } }
102 Put test for netgroup and nisdomain *)
103 test Access.lns put "+ : @group : ALL \n" after
104 set "/access/netgroup[. = 'group']/nisdomain" "domain" =
105 "+ : @group@@domain : ALL \n"
107 (* Check DOMAIN\user style entry *)
108 test Access.lns get "+ : root : foo1.bar.org foo3.bar.org
109 + : (DOMAIN\linux_users) : ALL
110 + : DOMAIN\linux_user : ALL\n" =
113 { "origin" = "foo1.bar.org" }
114 { "origin" = "foo3.bar.org" } }
116 { "group" = "DOMAIN\linux_users" }
117 { "origin" = "ALL" } }
119 { "user" = "DOMAIN\linux_user" }
120 { "origin" = "ALL" } }