Skip to content

Commit

Permalink
Remove MongoDB connection check and commented out code
Browse files Browse the repository at this point in the history
  • Loading branch information
Devasy23 committed Jan 12, 2024
1 parent 76126ac commit 26b5aa2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion main/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}


Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion testing/test_register_face.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 26b5aa2

Please sign in to comment.