Ejemplo n.º 1
0
 def test_shorten_url(self):
     scheme = "http"
     netloc = "localhost"
     unique, short_url = UrlShorten.shorten_url("https://www.google.com",
                                                scheme, netloc)
     self.assertEqual(unique, "ZDYyMw")
     self.assertEqual(short_url, "http://localhost/ZDYyMw")
Ejemplo n.º 2
0
 def test_shorten_url(self):
     scheme = 'http'
     netloc = 'localhost' + ':' + str(8888)
     unique, short_url = UrlShorten.shorten_url('https://www.google.com',
                                                scheme, netloc)
     self.assertEqual(unique, 'ZDYyMw')
     self.assertEqual(short_url,
                      'http://localhost:8888/forward?unique=ZDYyMw')
Ejemplo n.º 3
0
 def __create_shorten_url(self, url: str):
     netloc = ip_address + ":" + str(port)
     unique, short_url = UrlShorten.shorten_url(url, scheme, netloc)
     store.keep(unique, url)
     return short_url