Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / tests / test_networkmanager.aug
1 (*
2 Module: Test_NetworkManager
3   Provides unit tests and examples for the <NetworkManager> lens.
4 *)
5
6 module Test_NetworkManager =
7
8 (* Variable: conf *)
9 let conf = "[connection]
10 id=wifoobar
11 uuid=16fa8830-cf15-4523-8c1f-c6c635246855
12 permissions=user:foo:;
13 type=802-11-wireless
14
15 [802-11-wireless]
16 ssid=wifoobar
17 mode=infrastructure
18 mac-address=11:00:99:33:33:AA
19 security=802-11-wireless-security
20
21 [802-11-wireless-security]
22 key-mgmt=none
23 wep-key0=123abc123abc
24
25 [ipv4]
26 method=auto
27
28 [ipv6]
29 method=auto
30
31 [vpn]
32 NAT Traversal Mode=natt
33 DPD idle timeout (our side)=0\n"
34
35 let conf_psk = "[wifi]
36 ssid=TEST
37 mode=infrastructure
38
39 [wifi-security]
40 key-mgmt=wpa-psk
41 auth-alg=open
42 psk=\"#weird but valid psk!\"\n"
43
44 let conf_empty = ""
45
46 (* Test: NetworkManager.lns *)
47 test NetworkManager.lns get conf =
48   { "connection"
49     { "id" = "wifoobar" }
50     { "uuid" = "16fa8830-cf15-4523-8c1f-c6c635246855" }
51     { "permissions" = "user:foo:;" }
52     { "type" = "802-11-wireless" }
53     {  }
54   }
55   { "802-11-wireless"
56     { "ssid" = "wifoobar" }
57     { "mode" = "infrastructure" }
58     { "mac-address" = "11:00:99:33:33:AA" }
59     { "security" = "802-11-wireless-security" }
60     {  }
61   }
62   { "802-11-wireless-security"
63     { "key-mgmt" = "none" }
64     { "wep-key0" = "123abc123abc" }
65     {  }
66   }
67   { "ipv4"
68     { "method" = "auto" }
69     {  }
70   }
71   { "ipv6"
72     { "method" = "auto" }
73     {  }
74   }
75   { "vpn"
76     { "NAT Traversal Mode" = "natt" }
77     { "DPD idle timeout (our side)" = "0" }
78   }
79
80 (* Test: NetworkManager.lns - nontrivial WPA-PSK *)
81 test NetworkManager.lns get conf_psk =
82   { "wifi"
83     { "ssid" = "TEST" }
84     { "mode" = "infrastructure" }
85     {  }
86   }
87   { "wifi-security"
88     { "key-mgmt" = "wpa-psk" }
89     { "auth-alg" = "open" }
90     { "psk" = "\"#weird but valid psk!\"" }
91   }
92
93 (* Test: NetworkManager.lns - write new values unquoted *)
94 test NetworkManager.lns put conf_empty after
95     insa "wifi-security" "/";
96     set "wifi-security/psk" "#the key"
97   = "[wifi-security]
98 psk=#the key\n"