You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

43 lines
1.1 KiB

  1. # -*- coding: utf-8 -*-
  2. from base import *
  3. from requests import *
  4. class TestDirlist(CurlRequest):
  5. URL = "/foo/"
  6. EXPECT_RESPONSE_CODE = 200
  7. EXPECT_RESPONSE_HEADERS = [("Content-Type", "text/html; charset=utf-8")]
  8. class TestRedirectDir(CurlRequest):
  9. URL = "/foo"
  10. EXPECT_RESPONSE_CODE = 301
  11. EXPECT_RESPONSE_HEADERS = [("Location", "http://dirlist/foo/")]
  12. class TestRedirectDirWithQuery(CurlRequest):
  13. URL = "/foo?bar=baz"
  14. EXPECT_RESPONSE_CODE = 301
  15. EXPECT_RESPONSE_HEADERS = [("Location", "http://dirlist/foo/?bar=baz")]
  16. class TestRedirectDirWithQueryAndSpecialChars(CurlRequest):
  17. URL = "/f%3f%20o?bar=baz"
  18. EXPECT_RESPONSE_CODE = 301
  19. EXPECT_RESPONSE_HEADERS = [("Location", "http://dirlist/f%3f%20o/?bar=baz")]
  20. class Test(GroupTest):
  21. group = [
  22. TestDirlist,
  23. TestRedirectDir,
  24. TestRedirectDirWithQuery,
  25. ]
  26. config = """
  27. setup { module_load "mod_dirlist"; }
  28. dirlist;
  29. """
  30. def Prepare(self):
  31. self.PrepareDir("www/vhosts/dirlist/foo")
  32. self.PrepareFile("www/vhosts/dirlist/foo/test.txt", "abc")
  33. self.PrepareDir("www/vhosts/dirlist/f? o")
  34. self.PrepareFile("www/vhosts/dirlist/f? o/test.txt", "abc")