소스 검색

[tests] add tests for mod_dirlist

Change-Id: I5d6ea970cd5dca7e202c8bd888142e44ef8f4211
master
Stefan Bühler 3 달 전
부모
커밋
a5d3e11c1f
1개의 변경된 파일42개의 추가작업 그리고 0개의 파일을 삭제
  1. +42
    -0
      tests/t-dirlist.py

+ 42
- 0
tests/t-dirlist.py 파일 보기

@@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-

from base import *
from requests import *

class TestDirlist(CurlRequest):
URL = "/foo/"
EXPECT_RESPONSE_CODE = 200
EXPECT_RESPONSE_HEADERS = [("Content-Type", "text/html; charset=utf-8")]

class TestRedirectDir(CurlRequest):
URL = "/foo"
EXPECT_RESPONSE_CODE = 301
EXPECT_RESPONSE_HEADERS = [("Location", "http://dirlist/foo/")]

class TestRedirectDirWithQuery(CurlRequest):
URL = "/foo?bar=baz"
EXPECT_RESPONSE_CODE = 301
EXPECT_RESPONSE_HEADERS = [("Location", "http://dirlist/foo/?bar=baz")]

class TestRedirectDirWithQueryAndSpecialChars(CurlRequest):
URL = "/f%3f%20o?bar=baz"
EXPECT_RESPONSE_CODE = 301
EXPECT_RESPONSE_HEADERS = [("Location", "http://dirlist/f%3f%20o/?bar=baz")]

class Test(GroupTest):
group = [
TestDirlist,
TestRedirectDir,
TestRedirectDirWithQuery,
]

config = """
setup { module_load "mod_dirlist"; }
dirlist;
"""

def Prepare(self):
self.PrepareDir("www/vhosts/dirlist/foo")
self.PrepareFile("www/vhosts/dirlist/foo/test.txt", "abc")
self.PrepareDir("www/vhosts/dirlist/f? o")
self.PrepareFile("www/vhosts/dirlist/f? o/test.txt", "abc")

불러오는 중...
취소
저장