Added manga-py source

This commit is contained in:
2019-12-14 22:33:14 -05:00
parent 9a4dd4b09b
commit 45067caea6
420 changed files with 18054 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
import unittest
from os import path
from manga_py import fs
from manga_py.provider import Provider
from manga_py.providers import get_provider
root_path = path.dirname(path.realpath(__file__))
class TestInitProvider(unittest.TestCase):
# success
def test_get_provider1(self):
provider = get_provider('http://readmanga.me/manga/name/here')
self.assertIsInstance(provider(), Provider)
# failed
def test_get_provider2(self):
provider = get_provider('http://example.org/manga/name/here')
self.assertFalse(provider)
def test_root_path(self):
self.assertEqual(path.realpath(fs.path_join(root_path, '..')), fs.root_path())
def test_file_name_query_remove1(self):
name = '/addr/to/filename'
self.assertEqual(
name,
fs.remove_file_query_params(name + '?query=params').replace('\\', '/') # windows os patch
)
def test_file_name_query_remove2(self):
name = '/addr/to/filename/'
self.assertEqual(
name + 'image.png',
fs.remove_file_query_params(name + '?query=params').replace('\\', '/') # windows os patch
)