mirror of
https://github.com/UofCBaja/Interview-Backend.git
synced 2025-06-15 05:14:20 -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 {
|
||||
"statusCode": 200,
|
||||
"isBase64ENcoded": "false",
|
||||
"body": json.dumps(ymlschedule)
|
||||
"interviewDates": 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")
|
||||
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
|
||||
|
@ -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:
|
||||
|
13
testhttp.py
13
testhttp.py
@ -13,6 +13,13 @@ def BenchMarkDjango():
|
||||
# print(json.dumps(res, indent=1))
|
||||
|
||||
if __name__ == "__main__":
|
||||
djangoTime = timeit.timeit(stmt=BenchMarkDjango, number=10)
|
||||
pythonTime = timeit.timeit(stmt=BenchMarkServer, number=10)
|
||||
print(f"FastAPI: {djangoTime}\nPython: {pythonTime}")
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user