예제 #1
0
    def test_expand_url(self):
        service = Gitio()
        generated_long_url = service.expand_url(self.test_short_url)

        self.assertEqual(self.test_long_url, generated_long_url)
예제 #2
0
    def test_expand_url(self):
        service = Gitio()
        generated_long_url = service.expand_url(self.test_short_url)

        self.assertEqual(self.test_long_url, generated_long_url)
예제 #3
0
            sys.exit(-1)
    else:
        options.service = 'goo.gl'

    # Now, instantiate the service object based upon user preference.
    service = None
    if 'goo.gl' == options.service:
        service = Googl(options.svc_api_key)
    elif 'bit.ly' == options.service:
        # bit.ly requires a login account and api key.
        if not options.login or not options.svc_api_key:
            print 'bit.ly requires a valid account and API key.'
            sys.exit(-1)
        service = Bitly(options.login, options.svc_api_key)
    if 'git.io' == options.service:
        service = Gitio()
    elif 'tinyurl.com' == options.service:
        service = TinyUrlcom()
    elif 'v.gd' == options.service:
        service = Vgd()
    elif 'is.gd' == options.service:
        service = Isgd()

    # Get QR code.
    if options.qr_img_path:
        if not options.short_url:
            print 'You need to specify a short url to get qr code.'
            print 'Usage: python %s -s <short_url> -q <image_path>' % (
                sys.argv[0])
            sys.exit(-1)
예제 #4
0
    def test_shorten_url(self):
        service = Gitio()
        generated_short_url = service.shorten_url(self.test_long_url)

        self.assertEqual(self.generated_short_url, generated_short_url)