mirror of
https://github.com/UofCBaja/Interview-Backend.git
synced 2025-06-15 13:24:19 -06:00
feat(Packagers): started testing for post requests
This commit is contained in:
parent
fcbee342b3
commit
a0712e15eb
@ -19,8 +19,6 @@ def getSchedulePackager():
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"statusCode": 200,
|
"interviewDates": json.dumps(ymlschedule)
|
||||||
"isBase64ENcoded": "false",
|
|
||||||
"body": json.dumps(ymlschedule)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
20
newMain.py
20
newMain.py
@ -30,7 +30,27 @@ from GetSchedulePackager import getSchedulePackager
|
|||||||
|
|
||||||
@app.get("/getSchedule")
|
@app.get("/getSchedule")
|
||||||
def getSchedule():
|
def getSchedule():
|
||||||
|
|
||||||
res = getSchedulePackager()
|
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(
|
return JSONResponse(
|
||||||
headers={
|
headers={
|
||||||
"isBase64Encoded": "false", # Header Modification
|
"isBase64Encoded": "false", # Header Modification
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import datetime
|
import datetime
|
||||||
|
import requests
|
||||||
|
|
||||||
def SelectAppointment (appointmentJson):
|
def SelectAppointment (appointmentJson):
|
||||||
"""
|
"""
|
||||||
@ -16,6 +17,8 @@ def SelectAppointment (appointmentJson):
|
|||||||
``Contact``: darkicewolf50@gmail.com
|
``Contact``: darkicewolf50@gmail.com
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
print(appointmentJson)
|
||||||
|
|
||||||
status = mockWriteFunction(appointmentJson)
|
status = mockWriteFunction(appointmentJson)
|
||||||
|
|
||||||
if status:
|
if status:
|
||||||
|
13
testhttp.py
13
testhttp.py
@ -13,6 +13,13 @@ def BenchMarkDjango():
|
|||||||
# print(json.dumps(res, indent=1))
|
# print(json.dumps(res, indent=1))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
djangoTime = timeit.timeit(stmt=BenchMarkDjango, number=10)
|
test = 0
|
||||||
pythonTime = timeit.timeit(stmt=BenchMarkServer, number=10)
|
if test:
|
||||||
print(f"FastAPI: {djangoTime}\nPython: {pythonTime}")
|
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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user