mirror of
https://github.com/RicterZ/nhentai.git
synced 2025-07-02 08:29:27 +02:00
add tests
This commit is contained in:
27
tests/test_parser.py
Normal file
27
tests/test_parser.py
Normal file
@ -0,0 +1,27 @@
|
||||
import unittest
|
||||
import os
|
||||
import urllib3.exceptions
|
||||
|
||||
from nhentai import constant
|
||||
from nhentai.cmdline import load_config
|
||||
from nhentai.parser import search_parser, doujinshi_parser, favorites_parser
|
||||
|
||||
|
||||
class TestParser(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
load_config()
|
||||
constant.CONFIG['cookie'] = os.getenv('NHENTAI_COOKIE')
|
||||
constant.CONFIG['useragent'] = os.getenv('NHENTAI_UA')
|
||||
|
||||
def test_search(self):
|
||||
result = search_parser('umaru', 'recent', [1], False)
|
||||
self.assertTrue(len(result) > 0)
|
||||
|
||||
def test_doujinshi_parser(self):
|
||||
result = doujinshi_parser(123456)
|
||||
self.assertTrue(result['pages'] == 84)
|
||||
|
||||
def test_favorites_parser(self):
|
||||
result = favorites_parser(page=[1])
|
||||
self.assertTrue(len(result) > 0)
|
Reference in New Issue
Block a user