Skip to content

Commit

Permalink
Improve documentation for access.aug and test_access.aug
Browse files Browse the repository at this point in the history
  • Loading branch information
raphink committed Dec 1, 2011
1 parent 395794b commit fcdf736
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/naturaldocs/conf/lenses/Menu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Group: Generic Modules {

Group: Tests and Examples {

File: Test_Access (tests/test_access.aug)
File: Test_Reprepro_Uploaders (tests/test_reprepro_uploaders.aug)
File: Test_IniFile (tests/test_inifile.aug)
} # Group: Tests and Examples
Expand Down
7 changes: 6 additions & 1 deletion lenses/access.aug
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,19 @@ About: Lens Usage

About: Configuration files
This lens applies to /etc/security/access.conf. See <filter>.

About: Examples
The <Test_Access> file contains various examples and tests.
*)
module Access =
autoload xfm

(* Group: Comments and empty lines *)
(* Variable: comment *)
let comment = Util.comment
(* Variable: empty line *)
(* Variable: empty *)
let empty = Util.empty

(* Group: Useful primitives *)
(* Variable: colon
* this is the standard field separator " : "
Expand Down Expand Up @@ -116,4 +120,5 @@ let lns = (comment|empty|entry) *
(* Variable: filter *)
let filter = incl "/etc/security/access.conf"

(* xfm *)
let xfm = transform lns filter
18 changes: 17 additions & 1 deletion lenses/tests/test_access.aug
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
(*
Module: Test_Access
Provides unit tests and examples for the <Access> lens.
*)

module Test_access =

(* Variable: conf
A full configuration *)
let conf = "+ : ALL : LOCAL
+ : root : localhost.localdomain
- : root : 127.0.0.1 .localdomain
Expand All @@ -12,6 +19,8 @@ let conf = "+ : ALL : LOCAL
+:root:.example.com
"

(* Test: Access.lns
Test the full <conf> *)
test Access.lns get conf =
{ "access" = "+"
{ "user" = "ALL" }
Expand Down Expand Up @@ -77,13 +86,20 @@ test Access.lns put conf after
- : ALL : ALL
"

(* Bug #190 *)
(* Test: Access.lns
- netgroups (starting with '@') are mapped as "netgroup" nodes;
- nisdomains (starting with '@@') are mapped as "nisdomain" nodes.

This closes <ticket #190 at https://fedorahosted.org/augeas/ticket/190>.
*)
test Access.lns get "+ : @group@@domain : ALL \n" =
{ "access" = "+"
{ "netgroup" = "group"
{ "nisdomain" = "domain" } }
{ "origin" = "ALL" } }

(* Test Access.lns
Put test for netgroup and nisdomain *)
test Access.lns put "+ : @group : ALL \n" after
set "/access/netgroup[. = 'group']/nisdomain" "domain" =
"+ : @group@@domain : ALL \n"

0 comments on commit fcdf736

Please sign in to comment.