예제 #1
0
 def test_manualcrop1(self):
     bp = Base()
     img = files_paths[0]
     fs.unlink(root_path + img[1])
     bp._image_params['offsets_crop'] = (10, 32, 12, 5)
     bp.image_manual_crop(root_path + img[0], root_path + img[1])
     self.assertTrue(fs.is_file(root_path + img[1]))
예제 #2
0
 def test_cookies0(self):
     bp = Base()
     bp._params['url'] = 'http://example.org/manga/here.html'
     url = 'https://httpbin.org/cookies'
     cookies = {'test': 'test-cookie'}
     self.assertEqual(
         cookies,
         json.loads(bp.http_get(url, cookies=cookies))['cookies'])
예제 #3
0
 def test_redirect1(self):
     bp = Base()
     bp._params['url'] = 'http://example.org/manga/here.html'
     url = 'https://httpbin.org/redirect/11'
     self.assertRaises(AttributeError, bp.http_get, url)
예제 #4
0
 def test_redirect0(self):
     bp = Base()
     bp._params['url'] = 'http://example.org/manga/here.html'
     url = 'https://httpbin.org/redirect-to?url=https://httpbin.org/get?test=1'
     test_data = {'test': '1'}
     self.assertEqual(test_data, json.loads(bp.http_get(url))['args'])
예제 #5
0
 def test_cookies1(self):
     bp = Base()
     bp._params['url'] = 'http://example.org/manga/here.html'
     url = 'https://httpbin.org/cookies/set?test=test-cookie'
     self.assertEqual('test-cookie',
                      bp.http().get_base_cookies(url).get('test'))
예제 #6
0
 def test_post(self):
     bp = Base()
     bp._params['url'] = 'http://example.org/manga/here.html'
     url = 'https://httpbin.org/post'
     self.assertEqual(url, json.loads(bp.http_post(url))['url'])
예제 #7
0
 def test_autocrop(self):
     bp = Base()
     img = files_paths[0]
     fs.unlink(root_path + img[1])
     bp.image_auto_crop(root_path + img[0], root_path + img[1])
     self.assertTrue(fs.is_file(root_path + img[1]))
예제 #8
0
 def test_base1(self):
     bp = Base()
     self.assertRaises(KeyError, bp.get_url)
예제 #9
0
 def test_base0(self):
     bp = Base()
     domain = 'http://example.org'
     bp._params['url'] = domain + '/manga/here.html'
     self.assertEqual(bp._params['url'], bp.get_url())
     self.assertEqual(domain, bp.domain)