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)
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)
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))
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)