Ejemplo n.º 1
0
class TestBasePlugin(unittest.TestCase):
    def setUp(self):
        self.base_plugin = BasePlugin(None, [], None, None, get_config(), False, True)
        self.base_plugin.resp = requests.Response()

    def test_basic_matcher(self):
        matcher = BasePlugin.get_basic_matcher("tangerinepulsar.com")
        self.assertTrue(matcher.match("http://tangerinepulsar.com"))

    def test_image_header_jpeg(self):
        self.base_plugin.resp.headers = {"content-type": "image/jpeg"}
        self.assertTrue(self.base_plugin.valid_image_header())

    def test_image_header_jpg(self):
        self.base_plugin.resp.headers = {"content-type": "image/jpg"}
        self.assertTrue(self.base_plugin.valid_image_header())

    def test_image_header_gif(self):
        self.base_plugin.resp.headers = {"content-type": "image/gif"}
        self.assertTrue(self.base_plugin.valid_image_header())

    def test_image_header_bmp(self):
        self.base_plugin.resp.headers = {"content-type": "image/bmp"}
        self.assertTrue(self.base_plugin.valid_image_header())

    def test_image_header_png(self):
        self.base_plugin.resp.headers = {"content-type": "image/png"}
        self.assertTrue(self.base_plugin.valid_image_header())

    def tearDown(self):
        pass
Ejemplo n.º 2
0
 def url_matches(url):
     """
     This matches all tumblr urls
     """
     if BasePlugin.get_basic_matcher('tumblr.com').match(url):
         return True
     else:
         return False
Ejemplo n.º 3
0
 def url_matches(url):
     """
     This matches all of imgur
     """
     if BasePlugin.get_basic_matcher('imgur.com').match(url):
         return True
     else:
         return False
Ejemplo n.º 4
0
 def url_matches(url):
     """
     This matches a gfycat link
     """
     if BasePlugin.get_basic_matcher('gfycat.com').match(url):
         return True
     else:
         return False
Ejemplo n.º 5
0
 def url_matches(url):
     """
     This matches 500px photo pages
     """
     if BasePlugin.get_basic_matcher('500px.com').match(url):
         return True
     else:
         return False
Ejemplo n.º 6
0
 def url_matches(url):
     """
     This matches only wallbase user collections.
     """
     if BasePlugin.get_basic_matcher('wallbase.cc').match(url):
         return True
     else:
         return False
Ejemplo n.º 7
0
 def url_matches(url):
     """
     This is matches all deviant art pages
     """
     if BasePlugin.get_basic_matcher('deviantart.com').match(url):
         return True
     else:
         return False
Ejemplo n.º 8
0
 def url_matches(url):
     """
     This matches flickr photo pages
     """
     #QUESTION: is /photos needed here?
     flickr_pat = BasePlugin.get_basic_matcher('flickr.com/photos')
     if flickr_pat.match(url):
         return True
     else:
         return False
Ejemplo n.º 9
0
 def setUp(self):
     self.base_plugin = BasePlugin(None, [], None, None, get_config(), False, True)
     self.base_plugin.resp = requests.Response()
Ejemplo n.º 10
0
 def test_basic_matcher(self):
     matcher = BasePlugin.get_basic_matcher("tangerinepulsar.com")
     self.assertTrue(matcher.match("http://tangerinepulsar.com"))