mirror of
https://github.com/ajurna/cbwebreader.git
synced 2026-11-02 10:36:55 +00:00
**Replace Flake8 with Ruff, refactor type hints, and enhance archive processing logic**
- Removed `flake8` and `flake8-annotations` from dependencies, replaced by `ruff` for linting. - Introduced cleaner type hinting and modern Python annotations (PEP 604 style) across multiple modules. - Moved archive processing to a dedicated helper (`comic.archives`) for improved maintainability. - Updated and simplified logic for archive file retrieval, directory cleaning, and user access validation. - Improved error handling and added support for user classification restrictions in API responses.
This commit is contained in:
1 parent
1148f4072b
commit
a7e9bd0743
16 files changed
+553
-4
No files matched your search
@@ -0,0 +1,22 @@
|
||||
"""Tests for breadcrumb generation."""
|
||||
|
||||
import pytest
|
||||
|
||||
from comic import models
|
||||
from comic.util import generate_breadcrumbs_from_path
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_breadcrumbs_run_from_home_to_the_book() -> None:
|
||||
parent = models.Directory.objects.create(name='Series')
|
||||
child = models.Directory.objects.create(name='Volume 1', parent=parent)
|
||||
book = models.ComicBook.objects.create(file_name='issue.cbz', directory=child)
|
||||
assert [crumb.name for crumb in generate_breadcrumbs_from_path(child, book)] == [
|
||||
'Home', 'Series', 'Volume 1', 'issue.cbz',
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_breadcrumbs_without_a_book_stop_at_the_directory() -> None:
|
||||
directory = models.Directory.objects.create(name='Series')
|
||||
assert [crumb.name for crumb in generate_breadcrumbs_from_path(directory)] == ['Home', 'Series']
|
||||
Reference in new issue
Block a user