Ejemplo n.º 1
0
    def test_vimeo_links_get_resolved(self):
        mock_response = MockResponse()
        requests.head = lambda *args, **kwargs: mock_response

        sl = ShortenedLink(shortened_url)
        sl.do_resolution()
        self.assertEquals('1234', sl.resolve())
Ejemplo n.º 2
0
    def test_urls_can_be_marked_unresolvable(self):
        sl = ShortenedLink(shortened_url)
        sl.not_vimeo()
        self.assertEquals(LINK_IS_NOT_VIMEO, sl.resolve())

        ttl = rc.conn.ttl(sl.key)
        self.assertTrue(0 < ttl <= LINK_TTL)
Ejemplo n.º 3
0
    def test_non_vimeo_links_get_marked_as_such(self):
        mock_response = MockResponse()
        mock_response.headers['location'] = 'http://google.com'
        requests.head = lambda *args, **kwargs: mock_response

        sl = ShortenedLink(shortened_url)
        sl.do_resolution()
        self.assertEquals(LINK_IS_NOT_VIMEO, sl.resolve())
Ejemplo n.º 4
0
    def test_resolve(self):
        sl = ShortenedLink(shortened_url)
        self.assertEquals(None, sl.resolve())
        sl.associate_with_vimeo_id(vimeo_id)
        self.assertEquals(vimeo_id, sl.resolve())

        ttl = rc.conn.ttl(sl.key)
        self.assertTrue(0 < ttl <= LINK_TTL)
Ejemplo n.º 5
0
 def test_non_vimeo_links_not_rechecked(self):
     sl = ShortenedLink(shortened_url)
     sl.not_vimeo()
     self.assertFalse(vimeo_id_from_url(shortened_url))
     self.assertFalse(self.enqueue_calls)