Skip to content

Commit 7171611

Browse files
committed
ci: add cryptography dep and fix conftest patching
1 parent 1762cb8 commit 7171611

File tree

2 files changed

+3
-25
lines changed

2 files changed

+3
-25
lines changed

backend/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ PyJWT>=2.8.0
3838
passlib>=1.7.4
3939
python-dotenv>=1.0.0
4040
hvac>=1.4.0
41+
cryptography>=41.0.0
4142

backend/tests/conftest.py

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,9 @@ def aggregate(self, pipeline):
334334
@pytest.fixture(scope='function')
335335
def mock_mongodb():
336336
fake_db = FakeMongoDB()
337+
# Only patch at the source (services.db) since all route modules import from there
338+
# This avoids trying to patch module attributes before the modules are imported
337339
patches = [
338-
# Patch in services.db module
339340
patch('services.db.users_coll', fake_db['users']),
340341
patch('services.db.rooms_coll', fake_db['rooms']),
341342
patch('services.db.shares_coll', fake_db['shares']),
@@ -344,30 +345,6 @@ def mock_mongodb():
344345
patch('services.db.settings_coll', fake_db['settings']),
345346
patch('services.db.invites_coll', fake_db['invites']),
346347
patch('services.db.notifications_coll', fake_db['notifications']),
347-
# Patch where imported in routes
348-
patch('routes.auth.users_coll', fake_db['users']),
349-
patch('routes.auth.refresh_tokens_coll', fake_db['refresh_tokens']),
350-
patch('routes.rooms.rooms_coll', fake_db['rooms']),
351-
patch('routes.rooms.shares_coll', fake_db['shares']),
352-
patch('routes.rooms.users_coll', fake_db['users']),
353-
patch('routes.rooms.strokes_coll', fake_db['strokes']),
354-
patch('routes.rooms.invites_coll', fake_db['invites']),
355-
patch('routes.rooms.notifications_coll', fake_db['notifications']),
356-
patch('routes.admin.rooms_coll', fake_db['rooms']),
357-
patch('routes.admin.settings_coll', fake_db['settings']),
358-
patch('routes.socketio_handlers.rooms_coll', fake_db['rooms']),
359-
patch('routes.socketio_handlers.shares_coll', fake_db['shares']),
360-
patch('routes.socketio_handlers.users_coll', fake_db['users']),
361-
patch('routes.get_canvas_data.strokes_coll', fake_db['strokes']),
362-
patch('routes.get_canvas_data.rooms_coll', fake_db['rooms']),
363-
patch('routes.submit_room_line.strokes_coll', fake_db['strokes']),
364-
patch('routes.submit_room_line.rooms_coll', fake_db['rooms']),
365-
patch('routes.submit_room_line.shares_coll', fake_db['shares']),
366-
patch('routes.clear_canvas.strokes_coll', fake_db['strokes']),
367-
# Patch where imported in middleware
368-
patch('middleware.auth.users_coll', fake_db['users']),
369-
patch('middleware.auth.rooms_coll', fake_db['rooms']),
370-
patch('middleware.auth.shares_coll', fake_db['shares']),
371348
]
372349

373350
# Start all patches

0 commit comments

Comments
 (0)