mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-05 06:09:57 -05:00
Hiding traceback when zim file does not match kiwix naming scheme.
This commit is contained in:
parent
bf5b787fb3
commit
0ceac364ec
2 changed files with 22 additions and 3 deletions
|
|
@ -200,6 +200,22 @@ async def test_get_zim_entry(test_session, async_client, test_zim):
|
|||
assert response.status_code == HTTPStatus.NOT_FOUND
|
||||
|
||||
|
||||
def test_parse_name():
|
||||
"""Zim file names that match the kiwix naming scheme are parsed. Non-matching names raise ValueError."""
|
||||
import pathlib
|
||||
from datetime import datetime
|
||||
|
||||
name, date = lib.parse_name(pathlib.Path('wikipedia_en_all_maxi_2023-01.zim'))
|
||||
assert name == 'wikipedia_en_all_maxi'
|
||||
assert date == datetime(2023, 1, 1)
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
lib.parse_name(pathlib.Path('edibleplantdb.zim'))
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
lib.parse_name(pathlib.Path('nodate.zim'))
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_find_outdated_zim_files(test_session, test_directory, test_zim_bytes, async_client):
|
||||
"""Outdated Zim files are found and reported. They can automatically be deleted."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue