コード例 #1
0
    def test_HTTPServerPostMyControllerUserInsert(self):
        (myURL, myPath, myBody, myHeader,
         codeSuccessful) = fx.fixtureHTTPPost(9)
        req = requests.post(myURL + myPath, json=myBody, headers=myHeader)

        resp = MyController()
        resp.requestsToDB(req.url.split("/"))
        # остаток пути      /insert/9
        # название функции  /userInsert
        self.assertEqual(req.status_code, codeSuccessful)
コード例 #2
0
 def test_HTTPServerPostMyServerCODE200(self):
     (myURL, myPath, myBody, myHeader,
      codeSuccessful) = fx.fixtureHTTPPost(9)
     req = requests.post(myURL + myPath, json=myBody, headers=myHeader)
     self.assertEqual(req.status_code, codeSuccessful)
コード例 #3
0
 def test_HTTPServerPostMyServerBody(self):
     (myURL, myPath, myBody, myHeader,
      codeSuccessful) = fx.fixtureHTTPPost(9)
     req = requests.post(myURL + myPath, json=myBody, headers=myHeader)
     body = req.text.split("?")[0]
     self.assertEqual(body, json.dumps(myBody))
コード例 #4
0
 def test_HTTPServerPostMyServerPath(self):
     (myURL, myPath, myBody, myHeader,
      codeSuccessful) = fx.fixtureHTTPPost(9)
     req = requests.post(myURL + myPath, json=myBody, headers=myHeader)
     path = req.text.split("?")[1]
     self.assertEqual(path, myPath)