-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
41 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
|
||
from zimscraperlib.zim import Archive | ||
|
||
ZIM_FILE_PATH = "/output/openZIM_testing.zim" | ||
|
||
|
||
def test_is_file(): | ||
"""Ensure ZIM file exists""" | ||
assert os.path.isfile(ZIM_FILE_PATH) | ||
|
||
|
||
def test_zim_main_page(): | ||
"""Ensure main page is a redirect to index.html""" | ||
|
||
main_entry = Archive(ZIM_FILE_PATH).main_entry | ||
assert main_entry.is_redirect | ||
assert main_entry.get_redirect_entry().path == "index.html" | ||
|
||
|
||
def test_zim_scraper(): | ||
"""Ensure scraper and zim title are present in metadata""" | ||
|
||
zim_fh = Archive(ZIM_FILE_PATH) | ||
scraper = zim_fh.get_text_metadata("scraper") | ||
zim_title = zim_fh.get_text_metadata("Title") | ||
|
||
assert "youtube2zim " in scraper | ||
assert "openZIM_testing" in zim_title |