-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathshortenerTest.py
More file actions
31 lines (19 loc) · 1 KB
/
shortenerTest.py
File metadata and controls
31 lines (19 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# -*- coding: utf-8 -*-
import unittest
from shortener import Shortener
class TestShortener(unittest.TestCase):
def testShortenNothing(self):
assert shortener.shorten('') == ''
def testShortenAnUrl(self):
assert shortener.shorten('http://www.valtech.fr/') == 'c8d2' # c8d2fca21b2386349dddb906f666a7c9b227f4c4
def testShortenALongUrl(self):
assert shortener.shorten('http://www.slideshare.net/jimmybourassa/introduction-google-app-engine-waq-2011-7088970') == '62f0' # 62f02e13fe2a1553ea47208fd6a30e4191ebcb76
def testShortenAnUrlWithLimit(self):
assert shortener.shorten('http://www.valtech.fr/', 2) == 'c8'
def testShortenAnUrlWithALongLimit(self):
assert shortener.shorten('http://www.valtech.fr/', 7) == 'c8d2fca'
def testShortenALongUrlWithALimit(self):
assert shortener.shorten('http://www.slideshare.net/jimmybourassa/introduction-google-app-engine-waq-2011-7088970', 10) == '62f02e13fe'
if __name__=="__main__":
shortener = Shortener()
unittest.main()