mirror of
https://github.com/StanGirard/quivr.git
synced 2024-11-22 11:33:57 +03:00
7acb52a963
# Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate):
39 lines
898 B
Python
39 lines
898 B
Python
from pathlib import Path
|
|
from uuid import uuid4
|
|
|
|
from quivr_core.files.file import FileExtension, QuivrFile
|
|
|
|
|
|
def test_create_file():
|
|
id = uuid4()
|
|
brain_id = uuid4()
|
|
qfile = QuivrFile(
|
|
id=id,
|
|
brain_id=brain_id,
|
|
original_filename="name",
|
|
path=Path("/tmp/name"),
|
|
file_extension=FileExtension.txt,
|
|
file_sha1="123",
|
|
)
|
|
|
|
assert qfile.id == id
|
|
assert qfile.brain_id == brain_id
|
|
assert qfile.original_filename == "name"
|
|
assert qfile.path == Path("/tmp/name")
|
|
|
|
|
|
def test_create_file_add_metadata():
|
|
id = uuid4()
|
|
brain_id = uuid4()
|
|
qfile = QuivrFile(
|
|
id=id,
|
|
brain_id=brain_id,
|
|
original_filename="name",
|
|
path=Path("/tmp/name"),
|
|
file_extension=FileExtension.txt,
|
|
file_sha1="123",
|
|
metadata={"other_id": "id"},
|
|
)
|
|
|
|
assert qfile.metadata["other_id"] == "id"
|