feat(Packagers): started testing for post requests

This commit is contained in:
darkicewolf50 2024-11-30 12:02:30 -07:00
parent fcbee342b3
commit a0712e15eb
6 changed files with 34 additions and 6 deletions

View File

@ -19,8 +19,6 @@ def getSchedulePackager():
"""
return {
"statusCode": 200,
"isBase64ENcoded": "false",
"body": json.dumps(ymlschedule)
"interviewDates": json.dumps(ymlschedule)
}

View File

@ -30,7 +30,27 @@ from GetSchedulePackager import getSchedulePackager
@app.get("/getSchedule")
def getSchedule():
res = getSchedulePackager()
return JSONResponse(
headers={
"isBase64Encoded": "false", # Header Modification
},
content={
"body": res
},
# status_code=200 commented out just to show how to change it if you wanted
)
from postSelectAppointment import SelectAppointment
@app.post("/SelectInterview")
def postSelectInterview(request):
res = SelectAppointment(request)
return JSONResponse(
headers={
"isBase64Encoded": "false", # Header Modification

View File

@ -1,5 +1,6 @@
import json
import datetime
import requests
def SelectAppointment (appointmentJson):
"""
@ -16,6 +17,8 @@ def SelectAppointment (appointmentJson):
``Contact``: darkicewolf50@gmail.com
"""
print(appointmentJson)
status = mockWriteFunction(appointmentJson)
if status:

View File

@ -13,6 +13,13 @@ def BenchMarkDjango():
# print(json.dumps(res, indent=1))
if __name__ == "__main__":
test = 0
if test:
djangoTime = timeit.timeit(stmt=BenchMarkDjango, number=10)
pythonTime = timeit.timeit(stmt=BenchMarkServer, number=10)
print(f"FastAPI: {djangoTime}\nPython: {pythonTime}")
reqbody = {
"body": {"message": "hello"}
}
rawRes = requests.post("http://localhost:8000/SelectInterview", reqbody)