@@ -391,7 +391,6 @@ def test_creator_metadata(fpath, lipsum_item):
391391 "_videos:no;_details:yes;_ftindex:yes" ,
392392 "Flavour" : "nopic" ,
393393 "Source" : "https://en.wikipedia.org/" ,
394- "Counter" : "image/jpeg=5;image/gif=3;image/png=2" ,
395394 "Scraper" : "sotoki 1.2.3" ,
396395 }
397396
@@ -417,12 +416,25 @@ def test_creator_metadata(fpath, lipsum_item):
417416 assert zim .get_metadata (name ).decode ("UTF-8" ) == value
418417
419418
420- def test_creator_metadata_nooverwrite (fpath , lipsum_item ):
419+ def test_creator_metadata_overwrite (fpath , lipsum_item , favicon_data ):
420+ """re-adding an Entry (even Metadata) now raises an exception (libzim 7.2+)"""
421421 with Creator (fpath ) as c :
422422 c .add_item (lipsum_item )
423+ with pytest .raises (RuntimeError , match = "Impossible to add" ):
424+ c .add_item (lipsum_item )
425+
423426 c .add_metadata ("Key" , "first" )
424- # re-setting a value prints a warning and ignore it
425- c .add_metadata ("Key" , "second" )
427+ with pytest .raises (RuntimeError , match = "Impossible to add" ):
428+ c .add_metadata ("Key" , "second" )
429+
430+ c .add_redirection ("home" , lipsum_item .get_path (), "Home" , {})
431+ with pytest .raises (RuntimeError , match = "Impossible to add" ):
432+ c .add_redirection ("home" , lipsum_item .get_path (), "Home again" , {})
433+
434+ c .add_illustration (48 , favicon_data )
435+ # this currently segfaults but it should not
436+ # with pytest.raises(RuntimeError, match="Impossible to add"):
437+ # c.add_illustration(48, favicon_data)
426438 zim = Archive (fpath )
427439 assert zim .get_metadata ("Key" ).decode ("UTF-8" ) == "first"
428440
0 commit comments