debut changement vers google drive
CI - Security, Lint & Tests / validate (push) Failing after 1m14s

This commit is contained in:
cedrick2711
2026-08-25 19:01:28 -04:00
parent d18979a3e9
commit 38defc53a5
20 changed files with 796 additions and 520 deletions
+23 -1
View File
@@ -19,7 +19,13 @@ import os
import pytest
from app.extensions import db
from app.storage import CONTRACTS_DIR, document_path, documents_root
from app.storage import (
CONTRACTS_DIR,
GOOGLE_DRIVE_PATH_PREFIX,
document_path,
documents_root,
store_uploaded_document,
)
class TestDocumentsRoot:
@@ -87,6 +93,22 @@ class TestDocumentPath:
assert first_old == second_old, 'and must not move the ones already filed'
class TestGoogleDriveStorage:
def test_new_uploads_store_an_opaque_drive_reference(self, monkeypatch):
from werkzeug.datastructures import FileStorage
monkeypatch.setenv('DOCUMENT_STORAGE_BACKEND', 'google_drive')
monkeypatch.setattr(
'app.storage.upload_google_drive_file',
lambda **_kwargs: 'drive-file-123',
)
upload = FileStorage(stream=_pdf(), filename='contract.pdf', content_type='application/pdf')
stored_path = store_uploaded_document(upload, os.path.join(CONTRACTS_DIR, 'new.pdf'))
assert stored_path == f'{GOOGLE_DRIVE_PATH_PREFIX}drive-file-123'
class TestThroughTheUploadRoute:
@pytest.fixture
def uploaded(self, app, client, as_role, make_user):