2
0
Fork 0
lighttpd2/tests/t-redirect.py

34 lines
749 B
Python
Raw Normal View History

2010-10-13 12:45:15 +00:00
# -*- coding: utf-8 -*-
from base import *
from requests import *
2013-09-10 10:08:44 +00:00
class TestRewrite1(CurlRequest):
URL = "/somefile"
EXPECT_RESPONSE_BODY = TEST_TXT
EXPECT_RESPONSE_CODE = 200
EXPECT_RESPONSE_HEADERS = [("Content-Type", "text/plain; charset=utf-8")]
2010-10-13 12:45:15 +00:00
config = """
2013-09-10 10:08:44 +00:00
rewrite "^/somefile$" => "/test.txt";
defaultaction;
2010-10-13 12:45:15 +00:00
"""
2013-09-10 10:08:44 +00:00
class TestRewrite2(CurlRequest):
URL = "/somefile"
EXPECT_RESPONSE_BODY = TEST_TXT
EXPECT_RESPONSE_CODE = 200
EXPECT_RESPONSE_HEADERS = [("Content-Type", "text/plain; charset=utf-8")]
config = """
2013-09-10 10:08:44 +00:00
rewrite "/somethingelse" => "/nothing", "^/somefile$" => "/test.txt";
defaultaction;
"""
2010-10-13 12:45:15 +00:00
class Test(GroupTest):
plain_config = """
2013-09-10 10:08:44 +00:00
setup { module_load "mod_rewrite"; }
2010-10-13 12:45:15 +00:00
"""
group = [
2013-09-10 10:08:44 +00:00
TestRewrite1,
TestRewrite2
2010-10-13 12:45:15 +00:00
]