2323 "Description" : "All articles (without images) from the english Wikipedia" ,
2424 "Language" : "eng" ,
2525 # Optional
26- "LongDescription " : "This ZIM file contains all articles (without images) from the english Wikipedia by 2009-11-10. The topics are ..." ,
26+ "Longdescription " : "This ZIM file contains all articles (without images) from the english Wikipedia by 2009-11-10. The topics are ..." ,
2727 "Licence" : "CC-BY" ,
2828 "Tags" : "wikipedia;_category:wikipedia;_pictures:no;_videos:no;_details:yes;_ftindex:yes" ,
2929 "Flavour" : "nopic" ,
3030 "Source" : "https://en.wikipedia.org/" ,
3131 "Counter" : "image/jpeg=5;image/gif=3;image/png=2" ,
32- "Scraper" : "mwoffliner 1.2.3"
32+ "Scraper" : "sotoki 1.2.3"
3333}
3434
3535class ZimTestArticle (ZimArticle ):
@@ -95,9 +95,24 @@ def test_write_article(self):
9595 zim_creator .add_article (self .test_article )
9696 # Set mandatory metadata
9797 zim_creator .update_metadata (creator = 'python-libzim' ,description = 'Created in python' ,name = 'Hola' ,publisher = 'Monadical' ,title = 'Test Zim' )
98- zim_creator .write_metadata (zim_creator ._get_metadata ())
9998 zim_creator .finalize ()
100-
99+
100+ def test_article_metadata (self ):
101+ import uuid
102+ rnd_str = str (uuid .uuid1 ())
103+ zim_creator = ZimCreator (self .test_zim_file_path + '-' + rnd_str + '.zim' ,main_page = "welcome" ,index_language = "eng" , min_chunk_size = 2048 )
104+ zim_creator .update_metadata (** TEST_METADATA )
105+ self .assertEqual (zim_creator ._get_metadata (), TEST_METADATA )
106+
107+ def test_check_mandatory_metadata (self ):
108+ import uuid
109+ rnd_str = str (uuid .uuid1 ())
110+ zim_creator = ZimCreator (self .test_zim_file_path + '-' + rnd_str + '.zim' ,main_page = "welcome" ,index_language = "eng" , min_chunk_size = 2048 )
111+ self .assertFalse (zim_creator .mandatory_metadata_ok ())
112+ zim_creator .update_metadata (creator = 'python-libzim' ,description = 'Created in python' ,name = 'Hola' ,publisher = 'Monadical' ,title = 'Test Zim' )
113+ self .assertTrue (zim_creator .mandatory_metadata_ok ())
114+
115+
101116
102117if __name__ == '__main__' :
103118 unittest .main ()
0 commit comments