Exemple #1
0
    def test_turnoff(self, tmpdir):
        httpmocks.page('https://turnoff.us/', 'turnoff-home')
        httpmocks.page('https://turnoff.us/geek/the-bad-design-punisher',
                       'turnoff-229')

        httpmocks.png(re.compile(r'https://turnoff\.us/image/en/.*\.png'))

        cmd('--numstrips', '2', '--basepath', str(tmpdir), 'turnoff')
Exemple #2
0
    def test_fetch_html_broken_img(self, tmp_path):
        httpmocks.page('http://www.bloomingfaeries.com/', 'bf-home')
        httpmocks.page(re.compile('http://www.*faeries-405/'), 'bf-405')
        responses.add(responses.GET, re.compile(r'.*\.jpg'), body=b'\377\330',
            content_type='image/jpeg')

        cmd_ok("--numstrips", "2", "--baseurl", "bla", "--basepath",
            str(tmp_path), "--output", "html", "--adult", "BloomingFaeries")

        html = next((tmp_path / 'html').glob('*.html')).read_text()
        assert "width=" not in html
Exemple #3
0
    def test_fetch_html_and_rss_2(self, tmp_path):
        httpmocks.page('http://www.bloomingfaeries.com/', 'bf-home')
        httpmocks.page(re.compile('http://www.*faeries-405/'), 'bf-405')
        httpmocks.png(re.compile(r'http://www\.blooming.*405.*jpg'))
        httpmocks.png(re.compile(r'http://www\.blooming.*406.*jpg'), 'tall')

        cmd_ok("--numstrips", "2", "--baseurl", "bla", "--basepath",
            str(tmp_path), "--output", "rss", "--output", "html", "--adult",
            "BloomingFaeries")

        html = next((tmp_path / 'html').glob('*.html')).read_text()
        assert "width=" in html
Exemple #4
0
    def test_gocomics_index(self, tmpdir):
        httpmocks.page('https://www.gocomics.com/calvinandhobbesespanol',
                       'gocomics-root')
        httpmocks.page(re.compile('.*espanol/2020/03/25'), 'gocomics-page')
        httpmocks.page(re.compile('.*espanol/2012/07/22'), 'gocomics-page')

        httpmocks.png(re.compile(r'https://assets\..*'))

        cmd('--basepath', str(tmpdir), 'CalvinAndHobbesEnEspanol')
        cmd('--basepath', str(tmpdir), 'CalvinAndHobbesEnEspanol:2012/07/22')
Exemple #5
0
    def test_json_page_key_bounce_and_multi_image(self, tmpdir):
        httpmocks.page('https://zenpencils.com/', 'zp-home')
        httpmocks.page('https://zenpencils.com/comic/missing/', 'zp-223')
        httpmocks.page('https://zenpencils.com/comic/lifejacket/', 'zp-222')
        httpmocks.jpeg(re.compile(r'https://cdn-.*\.jpg'))

        cmd_ok("-v", "-b", str(tmpdir), "-o", "json", "ZenPencils")

        directory = tmpdir.join('ZenPencils')
        f = directory.join('dosage.json').open(encoding='utf-8')
        data = json.load(f)
        f.close()

        pages = data['pages']
        assert len(pages) == 1

        page = list(pages.keys())[0]
        assert page == 'https://zenpencils.com/comic/missing/'

        images = data['pages'][page]['images']
        assert len(images) == 2

        for imgurl, imgfile in images.items():
            assert directory.join(imgfile).check(file=1)