add(chore): bulk requests
This commit is contained in:
+12
-1
@@ -4,7 +4,7 @@ from wordarr.importer.matcher import best_matches, normalize
|
||||
|
||||
|
||||
def req(id, title, authors="", media_type="ebook"):
|
||||
return SimpleNamespace(id=id, title=title, authors=authors, media_type=media_type)
|
||||
return SimpleNamespace(id=id, title=title, authors=authors, media_type=media_type, volume=None)
|
||||
|
||||
|
||||
def test_normalize():
|
||||
@@ -36,3 +36,14 @@ def test_media_type_filter():
|
||||
"is_dir": False, "files": ["/d/dune.epub"]}]
|
||||
out = best_matches(items, requests)
|
||||
assert out[0]["suggested_request_id"] is None
|
||||
|
||||
|
||||
def test_volume_number_must_match():
|
||||
r1 = req(1, "Die drei ??? Folge 001", "", media_type="audiobook")
|
||||
r1.volume = 1
|
||||
r123 = req(2, "Die drei ??? Folge 123", "", media_type="audiobook")
|
||||
r123.volume = 123
|
||||
items = [{"path": "/d/f.mp3", "name": "Die drei Fragezeichen - Folge 123 - Der Superpapagei",
|
||||
"media_type": "audiobook", "is_dir": False, "files": ["/d/f.mp3"]}]
|
||||
out = best_matches(items, [r1, r123])
|
||||
assert out[0]["suggested_request_id"] == 2
|
||||
|
||||
Reference in New Issue
Block a user