Esempio n. 1
0
    def test_multipart_form(self):

      context  = TestContext.default_context()
      filename = os.getcwd() + "/tests/input/data-multipart-form-data-chrome.txt"
      filesize = os.path.getsize(filename)
      body     = open(filename, "r")

      context["REQUEST_METHOD"] = "POST"
      context["PATH_INFO"]      = "/about/12345/read"
      context["wsgi.input"]     = body
      context["CONTENT_LENGTH"] = filesize
      context["CONTENT_TYPE"] = "multipart/form-data; boundary=----WebKitFormBoundaryy68h9UzzE0zpkUU7"

      self.application(context, TestContext.default_response())
      self.assertTrue(True)
Esempio n. 2
0
    def test_post(self):

      context  = TestContext.default_context()
      filename = os.getcwd() + "/tests/input/data-x-www-form-urlencoded.txt"
      filesize = os.path.getsize(filename)
      body     = open(filename, "r")

      context["REQUEST_METHOD"] = "POST"
      context["PATH_INFO"]      = "/about/12345/read"
      context["wsgi.input"]     = body
      context["CONTENT_LENGTH"] = filesize
      context["CONTENT_TYPE"] = "application/x-www-form-urlencoded"

      self.application(context, TestContext.default_response())
      self.assertTrue(True)