Exemplo 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)
Exemplo 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)
Exemplo n.º 3
0
    def test_foo(self):
        #print("TestCrazyHorseRoutes: " + str(self))
        test_environ        = {"PATH_INFO": "/nano",
                               "REQUEST_METHOD": "GET",
                               "HTTP_USER_AGENT": "Unknown",
                               "HTTP_ACCEPT":"text/html",
                               'QUERY_STRING': '&id=12&lucy=dog',
                               "HTTP_ACCEPT_LANGUAGE":"en-US",
                               "HTTP_ACCEPT_CHARSET":"utf-8",
                               "REMOTE_ADDR":"127.0.0.1"}

        self.application(test_environ, TestContext.default_response())
        self.assertTrue(True)
    def setUp(self):
        fd, self.config_file = tempfile.mkstemp()
        os.close(fd)

        self.conf_no_key = {
            "git_follow": True,
            "git_repo": "github",
            "git_ref": "master",
            "sensor_list": ["A", "B", "C"],
            "post_path": "XYZ",
            "server_url": "http:???",
            "config_path": "xyz",
            "device_id": "dev0"
        }

        self.conf = {
            "git_follow": True,
            "git_repo": "github",
            "git_ref": "master",
            "sensor_list": ["A", "B", "C"],
            "post_key": "Key",
            "post_path": "XYZ",
            "server_url": "http:???",
            "config_path": "xyz",
            "device_id": "dev0"
        }

        self.conf2 = {
            "git_follow": True,
            "git_repo": "github",
            "git_ref": "master",
            "sensor_list": ["A", "B", "C"],
            "post_key": "KeyX",
            "post_path": "XYZ",
            "server_url": "http:???",
            "config_path": "xyz",
            "device_id": "dev0"
        }

        self.tmpdir = tempfile.mkdtemp()
        self.context = TestContext()
Exemplo n.º 5
0
 def setUp(self):
     self.context = TestContext()
Exemplo n.º 6
0
    def setUp(self):
        fd, self.config_file = tempfile.mkstemp()
        os.close(fd)

        self.tmpdir = tempfile.mkdtemp()
        self.context = TestContext()