|
190 | 190 | "test_redirect": "-/favicon", |
191 | 191 | "test_redirect_to": "I/empty.png", |
192 | 192 | }, |
| 193 | + "small.zim": { |
| 194 | + "filename": "small.zim", |
| 195 | + "filesize": 41155, |
| 196 | + "new_ns": True, |
| 197 | + "mutlipart": False, |
| 198 | + "zim_uuid": "3581ae7eedd57e6cd2f1c0cab073643f", |
| 199 | + "metadata_keys": [ |
| 200 | + "Counter", |
| 201 | + "Creator", |
| 202 | + "Date", |
| 203 | + "Description", |
| 204 | + "Illustration_48x48@1", |
| 205 | + "Language", |
| 206 | + "Publisher", |
| 207 | + "Scraper", |
| 208 | + "Tags", |
| 209 | + "Title", |
| 210 | + ], |
| 211 | + "test_metadata": "Title", |
| 212 | + "test_metadata_value": "Test ZIM file", |
| 213 | + "has_main_entry": True, |
| 214 | + "has_favicon_entry": True, |
| 215 | + "has_fulltext_index": False, |
| 216 | + "has_title_index": True, |
| 217 | + "has_checksum": True, |
| 218 | + "checksum": None, |
| 219 | + "is_valid": True, |
| 220 | + "entry_count": 2, |
| 221 | + "all_entry_count": 16, |
| 222 | + "article_count": 1, |
| 223 | + "suggestion_string": None, |
| 224 | + "suggestion_count": None, |
| 225 | + "suggestion_result": None, |
| 226 | + "search_string": None, |
| 227 | + "search_count": None, |
| 228 | + "search_result": None, |
| 229 | + "test_path": "main.html", |
| 230 | + "test_title": "Test ZIM file", |
| 231 | + "test_mimetype": "text/html", |
| 232 | + "test_size": 207, |
| 233 | + "test_content_includes": "Test ZIM file", |
| 234 | + "test_redirect": None, |
| 235 | + "test_redirect_to": None, |
| 236 | + }, |
193 | 237 | } |
194 | 238 |
|
195 | 239 |
|
@@ -220,7 +264,7 @@ def all_zims(tmpdir_factory): |
220 | 264 | libzim_urls = [ |
221 | 265 | f"https://github.com/kiwix/kiwix-lib/raw/master/test/data/{name}" |
222 | 266 | for name in ("zimfile.zim", "example.zim", "corner_cases.zim") |
223 | | - ] |
| 267 | + ] + ["https://github.com/openzim/zim-testing-suite/raw/main/data/nons/small.zim"] |
224 | 268 |
|
225 | 269 | # download libzim tests |
226 | 270 | for url in libzim_urls: |
@@ -313,6 +357,9 @@ def test_reader_metadata( |
313 | 357 | assert zim.metadata_keys == metadata_keys |
314 | 358 | if test_metadata: |
315 | 359 | assert zim.get_metadata(test_metadata).decode("UTF-8") == test_metadata_value |
| 360 | + item = zim.get_metadata_item(test_metadata) |
| 361 | + assert item.mimetype == "text/plain" |
| 362 | + assert item.size > 1 |
316 | 363 |
|
317 | 364 |
|
318 | 365 | @pytest.mark.parametrize( |
@@ -347,6 +394,8 @@ def test_reader_main_favicon_entries( |
347 | 394 | assert zim.get_illustration_item().path == "Illustration_48x48@1" |
348 | 395 | assert zim.get_illustration_sizes() == {48} |
349 | 396 |
|
| 397 | + assert zim.get_metadata_item("Illustration_48x48@1").mimetype == "image/png" |
| 398 | + |
350 | 399 |
|
351 | 400 | @pytest.mark.parametrize( |
352 | 401 | *parametrize_for(["filename", "has_fulltext_index", "has_title_index"]) |
|
0 commit comments