Browse Source

[tests]: convert test cases to new config syntax

master
Stefan Bühler 10 years ago
parent
commit
3ef949bbb9
  1. 28
      tests/base.py
  2. 4
      tests/t-basic-gets.py
  3. 4
      tests/t-cgi.py
  4. 2
      tests/t-mime-type.py
  5. 8
      tests/t-mod-auth.py
  6. 4
      tests/t-mod-proxy.py

28
tests/base.py

@ -122,9 +122,9 @@ class TestBase(object):
config = """
# %s
var.reg_vhosts = var.reg_vhosts + [ "%s" : ${
log = [ "*": "file:%s" ];
accesslog = "%s";
var.reg_vhosts = var.reg_vhosts + [ "%s" => {
log [ "*" => "file:%s" ];
accesslog "%s";
%s
%s
}
@ -134,9 +134,9 @@ var.reg_vhosts = var.reg_vhosts + [ "%s" : ${
config = """
# %s
var.vhosts = var.vhosts + [ "%s" : ${
log = [ "*": "file:%s" ];
accesslog = "%s";
var.vhosts = var.vhosts + [ "%s" => {
log [ "*" => "file:%s" ];
accesslog "%s";
%s
%s
}
@ -339,20 +339,20 @@ setup {{
);
listen "127.0.0.1:{Env.port}";
log = [ "*": "stderr" ];
log [ "*" => "stderr" ];
lua.plugin "{Env.luadir}/core.lua";
lua.plugin "{Env.luadir}/secdownload.lua";
accesslog.format = "%h %V %u %t \\"%r\\" %>s %b \\"%{{Referer}}i\\" \\"%{{User-Agent}}i\\"";
accesslog = "{accesslog}";
accesslog.format "%h %V %u %t \\"%r\\" %>s %b \\"%{{Referer}}i\\" \\"%{{User-Agent}}i\\"";
accesslog "{accesslog}";
}}
log = [ "*": "file:{errorlog}" ];
log [ "*" => "file:{errorlog}" ];
defaultaction {{
defaultaction = {{
docroot "{Env.defaultwww}";
}}
}};
var.vhosts = [];
var.reg_vhosts = [];
@ -368,10 +368,10 @@ var.reg_vhosts = [];
self.config += """
var.reg_vhosts = var.reg_vhosts + [ "default": ${
var.reg_vhosts = var.reg_vhosts + [ "default" => {
defaultaction;
} ];
var.vhosts = var.vhosts + [ "default": ${
var.vhosts = var.vhosts + [ "default" => {
vhost.map_regex var.reg_vhosts;
} ];

4
tests/t-basic-gets.py

@ -59,7 +59,7 @@ class Test(GroupTest):
self.PrepareFile("www/default/test.txt", TEST_TXT)
show_env_info_lua = self.PrepareFile("lua/show_env_info.lua", LUA_SHOW_ENV_INFO)
self.plain_config = """
show_env_info {{
show_env_info = {{
lua.handler "{show_env_info_lua}";
}}
}};
""".format(show_env_info_lua = show_env_info_lua)

4
tests/t-cgi.py

@ -53,9 +53,9 @@ if phys.exists and phys.path =$ ".cgi" {
self.plain_config = """
setup {{ module_load "mod_fastcgi"; }}
cgi {{
cgi = {{
fastcgi "unix:{socket}";
}}
}};
""".format(socket = cgi.sockfile)
self.tests.add_service(cgi)

2
tests/t-mime-type.py

@ -30,7 +30,7 @@ class Test(GroupTest):
self.PrepareVHostFile("test.xt", "")
self.PrepareVHostFile("test.rxt", "")
self.config = """
mime_types = (
mime_types (
".txt" => "text/plain; charset=utf-8",
".xt" => "text/plain",
".rxt" => "text/strange",

8
tests/t-mod-auth.py

@ -85,15 +85,15 @@ class Test(GroupTest):
self.config = """
setup {{ module_load ( "mod_auth" ); }}
auth.debug = true;
auth.debug true;
if req.query == "plain" {{
auth.plain ["method": "basic", "realm": "Basic Auth Realm", "file": "{passwdfile}", "ttl": 10];
auth.plain ["method" => "basic", "realm" => "Basic Auth Realm", "file" => "{passwdfile}", "ttl" => 10];
}} else if req.query == "digest" {{
auth.htdigest ["method": "basic", "realm": "Realm1", "file": "{digestfile}", "ttl": 10];
auth.htdigest ["method" => "basic", "realm" => "Realm1", "file" => "{digestfile}", "ttl" => 10];
}} else if req.query == "deny" {{
auth.deny;
}} else {{
auth.htpasswd ["method": "basic", "realm": "Basic Auth Realm", "file": "{passwdfile}", "ttl": 10];
auth.htpasswd ["method" => "basic", "realm" => "Basic Auth Realm", "file" => "{passwdfile}", "ttl" => 10];
}}
defaultaction;

4
tests/t-mod-proxy.py

@ -35,7 +35,7 @@ class Test(GroupTest):
self.plain_config = """
setup {{ module_load "mod_proxy"; }}
set_host_header_basic_gets_lua {{
set_host_header_basic_gets_lua = {{
lua.handler "{set_host_header_lua}";
}}
}};
""".format(set_host_header_lua = set_host_header_lua)
Loading…
Cancel
Save