~ubuntu-branches/ubuntu/natty/augeas/natty

« back to all changes in this revision

Viewing changes to lenses/tests/test_httpd.aug

  • Committer: Bazaar Package Importer
  • Author(s): Raphaël Pinson
  • Date: 2011-02-24 09:32:22 UTC
  • mfrom: (1.2.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20110224093222-bfd4fkm6envek6ys
Tags: 0.8.0-0ubuntu1
* New upstream release.
* Remove obsolete ruby Build-Depend.
* Build PDF docs and add them to augeas-doc.
* Build-Depend on texlive-latex-base to build PDF docs.
* Install txt doc files in augeas-doc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
module Test_httpd =
 
2
 
 
3
(* directives testing *)
 
4
let d1 = "ServerRoot \"/etc/apache2\"\n"
 
5
test Httpd.directive get d1 =
 
6
  { "directive" = "ServerRoot"
 
7
    { "arg" = "\"/etc/apache2\"" }
 
8
  }
 
9
 
 
10
let d2 = "ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/\n"
 
11
test Httpd.directive get d2 =
 
12
  { "directive" = "ScriptAlias"
 
13
    { "arg" = "/cgi-bin/" }
 
14
    { "arg" = "/usr/lib/cgi-bin/" }
 
15
  }
 
16
 
 
17
let d3 = "LockFile /var/lock/apache2/accept.lock\n"
 
18
test Httpd.directive get d3 =
 
19
  { "directive" = "LockFile"
 
20
    { "arg" = "/var/lock/apache2/accept.lock" }
 
21
  }
 
22
 
 
23
let c1 = "
 
24
<IfModule>
 
25
</IfModule>
 
26
"
 
27
let c1_put =
 
28
"
 
29
<IfModule foo bar>
 
30
</IfModule>
 
31
"
 
32
 
 
33
 
 
34
test Httpd.lns get c1 = { }{ "IfModule" }
 
35
 
 
36
test Httpd.lns put c1 after set "/IfModule/arg[1]" "foo";
 
37
                            set "/IfModule/arg[2]" "bar" = c1_put
 
38
 
 
39
let c2 = "
 
40
<IfModule !mpm_winnt.c>
 
41
  <IfModule !mpm_netware.c>
 
42
    LockFile /var/lock/apache2/accept.lock
 
43
  </IfModule>
 
44
</IfModule>
 
45
"
 
46
 
 
47
test Httpd.lns get c2 =
 
48
  {  }
 
49
  { "IfModule"
 
50
    { "arg" = "!mpm_winnt.c" }
 
51
    { "IfModule"
 
52
      { "arg" = "!mpm_netware.c" }
 
53
      { "directive" = "LockFile"
 
54
        { "arg" = "/var/lock/apache2/accept.lock" }
 
55
      }
 
56
    }
 
57
  }
 
58
 
 
59
(* arguments must be the first child of the section *)
 
60
test Httpd.lns put c2 after rm "/IfModule/arg";
 
61
                            insb "arg" "/IfModule/*[1]";
 
62
                            set "/IfModule/arg" "foo"  =
 
63
"
 
64
<IfModule foo>
 
65
  <IfModule !mpm_netware.c>
 
66
    LockFile /var/lock/apache2/accept.lock
 
67
  </IfModule>
 
68
</IfModule>
 
69
"
 
70
 
 
71
let c3 = "
 
72
<IfModule mpm_event_module>
 
73
    StartServers          2
 
74
    MaxClients          150
 
75
    MinSpareThreads      25
 
76
    MaxSpareThreads      75
 
77
    ThreadLimit          64
 
78
    ThreadsPerChild      25
 
79
    MaxRequestsPerChild   0
 
80
</IfModule>
 
81
"
 
82
 
 
83
test Httpd.lns get c3 =
 
84
  {  }
 
85
  { "IfModule"
 
86
    { "arg" = "mpm_event_module" }
 
87
    { "directive" = "StartServers"
 
88
      { "arg" = "2" }
 
89
    }
 
90
    { "directive" = "MaxClients"
 
91
      { "arg" = "150" }
 
92
    }
 
93
    { "directive" = "MinSpareThreads"
 
94
      { "arg" = "25" }
 
95
    }
 
96
    { "directive" = "MaxSpareThreads"
 
97
      { "arg" = "75" }
 
98
    }
 
99
    { "directive" = "ThreadLimit"
 
100
      { "arg" = "64" }
 
101
    }
 
102
    { "directive" = "ThreadsPerChild"
 
103
      { "arg" = "25" }
 
104
    }
 
105
    { "directive" = "MaxRequestsPerChild"
 
106
      { "arg" = "0" }
 
107
    }
 
108
  }
 
109
 
 
110
 
 
111
 
 
112
let c4 = "
 
113
<Files ~ \"^\.ht\">
 
114
    Order allow,deny
 
115
    Deny from all
 
116
    Satisfy all
 
117
</Files>
 
118
"
 
119
 
 
120
test Httpd.lns get c4 =
 
121
  {  }
 
122
  { "Files"
 
123
    { "arg" = "~" }
 
124
    { "arg" = "\"^\.ht\"" }
 
125
    { "directive" = "Order"
 
126
      { "arg" = "allow,deny" }
 
127
    }
 
128
    { "directive" = "Deny"
 
129
      { "arg" = "from" }
 
130
      { "arg" = "all" }
 
131
    }
 
132
    { "directive" = "Satisfy"
 
133
      { "arg" = "all" }
 
134
    }
 
135
  }
 
136
 
 
137
 
 
138
 
 
139
let c5 = "LogFormat \"%{User-agent}i\" agent\n"
 
140
test Httpd.lns get c5 =
 
141
  { "directive" = "LogFormat"
 
142
    { "arg" = "\"%{User-agent}i\"" }
 
143
    { "arg" = "agent" }
 
144
  }
 
145
 
 
146
let c7 = "LogFormat \"%v:%p %h %l %u %t \\"%r\\" %>s %O \\"%{Referer}i\\" \\"%{User-Agent}i\\"\" vhost_combined\n"
 
147
test Httpd.lns get c7 =
 
148
  { "directive" = "LogFormat"
 
149
    { "arg" = "\"%v:%p %h %l %u %t \\"%r\\" %>s %O \\"%{Referer}i\\" \\"%{User-Agent}i\\"\"" }
 
150
    { "arg" = "vhost_combined" }
 
151
  }
 
152
 
 
153
let c8 = "IndexIgnore .??* *~ *# RCS CVS *,v *,t \n"
 
154
test Httpd.directive get c8 =
 
155
  { "directive" = "IndexIgnore"
 
156
    { "arg" = ".??*" }
 
157
    { "arg" = "*~" }
 
158
    { "arg" = "*#" }
 
159
    { "arg" = "RCS" }
 
160
    { "arg" = "CVS" }
 
161
    { "arg" = "*,v" }
 
162
    { "arg" = "*,t" }
 
163
  }
 
164
 
 
165
(* FIXME: not yet supported:
 
166
 * The backslash "\" may be used as the last character on a line to indicate
 
167
 * that the directive continues onto the next line. There must be no other
 
168
 * characters or white space between the backslash and the end of the line.
 
169
 *)
 
170
test Httpd.directive get "Options Indexes \
 
171
FollowSymLinks MultiViews\n" = *
 
172
(*
 
173
  { "directive" = "Options"
 
174
    { "arg" = "Indexes" }
 
175
    { "arg" = "FollowSymLinks" }
 
176
    { "arg" = "MultiViews" }
 
177
  }
 
178
*)
 
179
 
 
180
let conf2 = "<VirtualHost *:80>
 
181
    ServerAdmin webmaster@localhost
 
182
 
 
183
    DocumentRoot /var/www
 
184
    <Directory />
 
185
        Options FollowSymLinks
 
186
        AllowOverride None
 
187
    </Directory>
 
188
    <Directory /var/www/>
 
189
        Options Indexes FollowSymLinks MultiViews
 
190
        AllowOverride None
 
191
        Order allow,deny
 
192
        allow from all
 
193
    </Directory>
 
194
 
 
195
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
 
196
    <Directory \"/usr/lib/cgi-bin\">
 
197
        AllowOverride None
 
198
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
 
199
        Order allow,deny
 
200
        Allow from all
 
201
    </Directory>
 
202
 
 
203
    ErrorLog /var/log/apache2/error.log
 
204
 
 
205
    # Possible values include: debug, info, notice, warn, error, crit,
 
206
    # alert, emerg.
 
207
    LogLevel warn
 
208
 
 
209
    CustomLog /var/log/apache2/access.log combined
 
210
 
 
211
    SSLRequireSSL
 
212
 
 
213
    Alias /doc/ \"/usr/share/doc/\"
 
214
    <Directory \"/usr/share/doc/\">
 
215
        Options Indexes MultiViews FollowSymLinks
 
216
        AllowOverride None
 
217
        Order deny,allow
 
218
        Deny from all
 
219
        Allow from 127.0.0.0/255.0.0.0 ::1/128
 
220
    </Directory>
 
221
 
 
222
</VirtualHost>
 
223
"
 
224
 
 
225
test Httpd.lns get conf2 =
 
226
   { "VirtualHost"
 
227
    { "arg" = "*:80" }
 
228
    { "directive" = "ServerAdmin"
 
229
      { "arg" = "webmaster@localhost" }
 
230
    }
 
231
    {  }
 
232
    { "directive" = "DocumentRoot"
 
233
      { "arg" = "/var/www" }
 
234
    }
 
235
    { "Directory"
 
236
      { "arg" = "/" }
 
237
      { "directive" = "Options"
 
238
        { "arg" = "FollowSymLinks" }
 
239
      }
 
240
      { "directive" = "AllowOverride"
 
241
        { "arg" = "None" }
 
242
      }
 
243
    }
 
244
    { "Directory"
 
245
      { "arg" = "/var/www/" }
 
246
      { "directive" = "Options"
 
247
        { "arg" = "Indexes" }
 
248
        { "arg" = "FollowSymLinks" }
 
249
        { "arg" = "MultiViews" }
 
250
      }
 
251
      { "directive" = "AllowOverride"
 
252
        { "arg" = "None" }
 
253
      }
 
254
      { "directive" = "Order"
 
255
        { "arg" = "allow,deny" }
 
256
      }
 
257
      { "directive" = "allow"
 
258
        { "arg" = "from" }
 
259
        { "arg" = "all" }
 
260
      }
 
261
    }
 
262
    {  }
 
263
    { "directive" = "ScriptAlias"
 
264
      { "arg" = "/cgi-bin/" }
 
265
      { "arg" = "/usr/lib/cgi-bin/" }
 
266
    }
 
267
    { "Directory"
 
268
      { "arg" = "\"/usr/lib/cgi-bin\"" }
 
269
      { "directive" = "AllowOverride"
 
270
        { "arg" = "None" }
 
271
      }
 
272
      { "directive" = "Options"
 
273
        { "arg" = "+ExecCGI" }
 
274
        { "arg" = "-MultiViews" }
 
275
        { "arg" = "+SymLinksIfOwnerMatch" }
 
276
      }
 
277
      { "directive" = "Order"
 
278
        { "arg" = "allow,deny" }
 
279
      }
 
280
      { "directive" = "Allow"
 
281
        { "arg" = "from" }
 
282
        { "arg" = "all" }
 
283
      }
 
284
    }
 
285
    {  }
 
286
    { "directive" = "ErrorLog"
 
287
      { "arg" = "/var/log/apache2/error.log" }
 
288
    }
 
289
    {  }
 
290
    { "#comment" = "Possible values include: debug, info, notice, warn, error, crit," }
 
291
    { "#comment" = "alert, emerg." }
 
292
    { "directive" = "LogLevel"
 
293
      { "arg" = "warn" }
 
294
    }
 
295
    {  }
 
296
    { "directive" = "CustomLog"
 
297
      { "arg" = "/var/log/apache2/access.log" }
 
298
      { "arg" = "combined" }
 
299
    }
 
300
    {  }
 
301
    { "directive" = "SSLRequireSSL" }
 
302
    {  }
 
303
    { "directive" = "Alias"
 
304
      { "arg" = "/doc/" }
 
305
      { "arg" = "\"/usr/share/doc/\"" }
 
306
    }
 
307
    { "Directory"
 
308
      { "arg" = "\"/usr/share/doc/\"" }
 
309
      { "directive" = "Options"
 
310
        { "arg" = "Indexes" }
 
311
        { "arg" = "MultiViews" }
 
312
        { "arg" = "FollowSymLinks" }
 
313
      }
 
314
      { "directive" = "AllowOverride"
 
315
        { "arg" = "None" }
 
316
      }
 
317
      { "directive" = "Order"
 
318
        { "arg" = "deny,allow" }
 
319
      }
 
320
      { "directive" = "Deny"
 
321
        { "arg" = "from" }
 
322
        { "arg" = "all" }
 
323
      }
 
324
      { "directive" = "Allow"
 
325
        { "arg" = "from" }
 
326
        { "arg" = "127.0.0.0/255.0.0.0" }
 
327
        { "arg" = "::1/128" }
 
328
      }
 
329
    }
 
330
    {  }
 
331
  }
 
332