diff --git a/main/main.py b/main/main.py index 86889a4..183ac9f 100644 --- a/main/main.py +++ b/main/main.py @@ -24,7 +24,7 @@ async def register_face(file: UploadFile = File(...)): #save the file with open(f"{IMAGEDIR}{file.filename}", "wb") as f: f.write(contents) - db.images.insert_one({"filename": file.filename, "contents": contents}) + # db.images.insert_one({"filename": file.filename, "contents": contents}) return {"filename": file.filename} diff --git a/test-faces/35427069-8447-431e-a9f2-421a231528b4.jpg b/test-faces/35427069-8447-431e-a9f2-421a231528b4.jpg new file mode 100644 index 0000000..eb7a2bf Binary files /dev/null and b/test-faces/35427069-8447-431e-a9f2-421a231528b4.jpg differ diff --git a/test-faces/7d1dc694-073b-40cd-a18f-8010349bec74.jpg b/test-faces/7d1dc694-073b-40cd-a18f-8010349bec74.jpg new file mode 100644 index 0000000..eb7a2bf Binary files /dev/null and b/test-faces/7d1dc694-073b-40cd-a18f-8010349bec74.jpg differ diff --git a/testing/test_register_face.py b/testing/test_register_face.py index dc035dc..5f26915 100644 --- a/testing/test_register_face.py +++ b/testing/test_register_face.py @@ -3,7 +3,18 @@ from fastapi.testclient import TestClient from main.main import app import os - +from pymongo import MongoClient + +# def check_mongo_connection(): +# client = MongoClient('localhost', 27017) +# try: +# # The ismaster command is cheap and does not require auth. +# client.admin.command('ismaster') +# print("MongoDB is running") +# except Exception as e: +# print("Could not connect to MongoDB: %s" % e) + +# check_mongo_connection() client = TestClient(app) def test_register_face(): # Open a test image file in binary mode