Esempio n. 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]))
Esempio n. 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'])
Esempio n. 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)
Esempio n. 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'])
Esempio n. 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'))
Esempio n. 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'])
Esempio n. 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]))
Esempio n. 8
0
 def test_base1(self):
     bp = Base()
     self.assertRaises(KeyError, bp.get_url)
Esempio n. 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)