-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathencode_test.py
More file actions
31 lines (20 loc) · 853 Bytes
/
Copy pathencode_test.py
File metadata and controls
31 lines (20 loc) · 853 Bytes
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
31
import unittest
import encode
class TestMain(unittest.TestCase):
def test_empty_input(self):
output = encode.main([])
self.assertEqual(0, len(output["items"]))
def test_spaces(self):
output = encode.main(["hello", "alfred"])
self.assertEqual("aGVsbG8gYWxmcmVk", output["items"][0]["arg"])
class TestEncode(unittest.TestCase):
def test_base64(self):
self.assertEqual("aGVsbG8gYWxmcmVk", encode.encode_base64("hello alfred"))
def test_json(self):
self.assertEqual(r'"{\"hello\": \"alfred\"}"', encode.encode_json('{"hello": "alfred"}'))
def test_url(self):
self.assertEqual("hello%20alfred", encode.encode_url("hello alfred"))
def test_html(self):
self.assertEqual("<br/>", encode.encode_html("<br/>"))
if __name__ == "__main__":
unittest.main()