Esempio n. 1
0
File: test.py Progetto: adcaes/Wrpp
	def testApp(self, n):
		a = App(0)
		urls = {}
		
		# Shorten n/2 URLS
		for url in range(0, n/2):
			short = a.get_short_url(url)
			assert type(short) == str
			assert short[0] == '0'
			urls[short] = url
	
		# Retrive n/2 long urls from short urls
		for shortUrl in urls.iterkeys():
			assert urls[shortUrl] == a.get_long_url(shortUrl)
			
		# Shorten n/2 URLS
		for url in range(n/2, n):
			short = a.get_short_url(url)
			assert type(short) == str
			assert short[0] == '0'
			urls[short] = url
	
		# Retrive n long urls from short urls
		for shortUrl in urls.iterkeys():
			assert urls[shortUrl] == a.get_long_url(shortUrl)