2022-06-14 09:44:36 -04:00
|
|
|
"""Test_file."""
|
2022-06-22 11:39:46 -04:00
|
|
|
from datetime import datetime
|
2022-06-22 21:46:40 -04:00
|
|
|
|
2022-06-13 14:58:07 -04:00
|
|
|
from spiffworkflow_backend.models.file import File
|
|
|
|
|
|
|
|
|
|
|
|
def test_files_can_be_sorted() -> None:
|
|
|
|
"""Test_files_can_be_sorted."""
|
|
|
|
europe = create_test_file(type="bpmn", name="europe")
|
|
|
|
asia = create_test_file(type="bpmn", name="asia")
|
|
|
|
africa = create_test_file(type="dmn", name="africa")
|
|
|
|
oceania = create_test_file(type="dmn", name="oceania")
|
|
|
|
|
|
|
|
mylist = [europe, oceania, asia, africa]
|
|
|
|
assert sorted(mylist) == [asia, europe, africa, oceania]
|
|
|
|
|
|
|
|
|
2022-06-21 17:28:59 -04:00
|
|
|
def create_test_file(type: str, name: str) -> File:
|
2022-06-13 14:58:07 -04:00
|
|
|
"""Create_test_file."""
|
2022-06-14 10:00:33 -04:00
|
|
|
return File(
|
|
|
|
type=type,
|
|
|
|
name=name,
|
|
|
|
content_type=type,
|
|
|
|
document={},
|
2022-06-22 11:39:46 -04:00
|
|
|
last_modified=datetime.now(),
|
2022-06-21 17:28:59 -04:00
|
|
|
size=1,
|
2022-06-14 10:00:33 -04:00
|
|
|
)
|