浏览代码

Replaced os.path in server.py

Angel Rey 5 年之前
父节点
当前提交
73418836f8
共有 1 个文件被更改,包括 5 次插入6 次删除
  1. 5 6
      tests/mock_server/server.py

+ 5 - 6
tests/mock_server/server.py

@@ -1,4 +1,3 @@
-from os.path import abspath
 from os import getcwd
 from pathlib import Path
 
@@ -10,20 +9,20 @@ def index():
 
 @route("/static/<filename>")
 def static_path(filename):
-    template_path = abspath(getcwd()) / Path("tests/mock_server/templates")
+    template_path = Path.cwd().resolve() / "tests/mock_server/templates"
     response = static_file(filename, root=template_path)
     return response
 
 @route("/static_no_content_type/<filename>")
 def static_no_content_type(filename):
-    template_path = abspath(getcwd()) / Path("tests/mock_server/templates")
+    template_path = Path.cwd().resolve() / "tests/mock_server/templates"
     response = static_file(filename, root=template_path)
     response.set_header("Content-Type", "")
     return response
 
 @route("/static/headers/<filename>")
 def static_path_with_headers(filename):
-    template_path = abspath(getcwd()) / Path("tests/mock_server/templates")
+    template_path = Path.cwd().resolve() / "tests/mock_server/templates"
     response = static_file(filename, root=template_path)
     response.add_header("Content-Language", "en")
     response.add_header("Content-Script-Type", "text/javascript")
@@ -32,7 +31,7 @@ def static_path_with_headers(filename):
 
 @route("/static/400/<filename>", method="HEAD")
 def static_400(filename):
-    template_path = abspath(getcwd()) / Path("tests/mock_server/templates")
+    template_path = Path.cwd().resolve() / "tests/mock_server/templates"
     response = static_file(filename, root=template_path)
     response.status = 400
     response.add_header("Status-Code", "400")
@@ -40,7 +39,7 @@ def static_400(filename):
 
 @route("/static/400/<filename>", method="GET")
 def static_200(filename):
-    template_path = abspath(getcwd()) / Path("tests/mock_server/templates")
+    template_path = Path.cwd().resolve() / "tests/mock_server/templates"
     response = static_file(filename, root=template_path)
     response.add_header("Status-Code", "200")
     return response