view feed2twitter/tests/test_shortener.py @ 29:606307f5bfa1

Adding new url shorteners
author Walter Cruz <walter@waltercruz.com>
date Wed, 19 Aug 2009 16:09:48 -0300
parents feed2twitter/tests/test_tinyurl.py@ad16b90dae70
children
line wrap: on
line source

# feed2twitter
# Copyright (C) 2008 Walter Cruz <walter@waltercruz.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from feed2twitter.shortener import services
import feed2twitter

def test_tiny():
    service = services['tinyurl']()
    url = service.short('http://google.com')
    assert('http://tinyurl.com/2tx' == url)

def test_isgd():
    service = services['is.gd']()
    url = service.short('http://ebc.com.br/') # I had some trouble testing with google.. looks like it will redirect to some
    # local version of google according to the IP, generating a different URL 
    assert('http://is.gd/2oFmH' == url)

def test_migreme():
    service = services['migre.me']()
    url = service.short('http://google.com')
    assert('http://migre.me/5tR0' == url)

def test_twitter():
    feed2twitter.update(shortener='migre.me',url='',mode='title',username='',password='')