Esempio n. 1
0
 def test_post(self):
     url = self.getURL("path")
     self.setupStep(http.POST(url))
     self.expectOutcome(result=SUCCESS, state_string="Status code: 200")
     self.expectLogfile('log', "URL: {}\nStatus: 200\n ------ Content ------\nOK:".format(url))
     self.expectLogfile('content', "OK:")
     return self.runStep()
Esempio n. 2
0
 def test_post(self):
     url = self.getURL("path")
     self.setup_step(http.POST(url))
     self.expect_outcome(result=SUCCESS, state_string="Status code: 200")
     self.expect_log_file(
         'log', f"URL: {url}\nStatus: 200\n ------ Content ------\nOK:")
     self.expect_log_file('content', "OK:")
     return self.run_step()
Esempio n. 3
0
 def test_POST(self):
     url = self.getURL("POST")
     self.setupStep(http.POST(url))
     self.expectLogfile('log', "URL: %s\n ------ Content ------\n\n<html>\n"
                        "  <head><title>405 - Method Not Allowed</title></head>\n"
                        "  <body>\n    <h1>Method Not Allowed</h1>\n    <p>Your browser "
                        "approached me (at /POST) with the method \"POST\".  I only allow the "
                        "methods HEAD, GET here.</p>\n  </body>\n</html>\n" % (url, ))
     self.expectOutcome(result=FAILURE, status_text=["Requested"])
     return self.runStep()
Esempio n. 4
0
 def test_POST(self):
     url = self.getURL("POST")
     content = "\n<html>\n" \
               "  <head><title>405 - Method Not Allowed</title></head>\n" \
               "  <body>\n    <h1>Method Not Allowed</h1>\n    <p>Your browser " \
               "approached me (at /POST) with the method \"POST\".  I only allow the " \
               "methods HEAD, GET here.</p>\n  </body>\n</html>\n"
     self.setupStep(http.POST(url))
     self.expectLogfile('log', "URL: %s\n ------ Content ------\n%s" % (url, content))
     self.expectLogfile('content', content)
     self.expectOutcome(result=FAILURE, state_string="Status code: 405 (failure)")
     return self.runStep()
Esempio n. 5
0
    def test_post_data_dict(self):
        url = self.getURL("path")

        self.setupStep(http.POST(url, data={'key1': 'value1'}))
        self.expectOutcome(result=SUCCESS, state_string="Status code: 200")
        self.expectLogfile('log', '''\
URL: {}
Status: 200
 ------ Content ------
OK:key1=value1'''.format(url))
        self.expectLogfile('content', "OK:key1=value1")
        return self.runStep()
Esempio n. 6
0
 def test_POST(self):
     url = self.getURL("POST")
     self.setupStep(http.POST(url))
     self.expectOutcome(result=FAILURE,
                        state_string="Status code: 405 (failure)")
     return self.runStep()