-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathtests.py
39 lines (26 loc) · 985 Bytes
/
tests.py
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
32
33
34
35
36
37
38
39
# -*- coding: utf-8 -*-
import unittest
import status
from status import InvalidHTTPStatusCode
class HTTPStatusCodeTest(unittest.TestCase):
def test_is_informational(self):
self.assertTrue(status.is_informational(105))
def test_is_success(self):
self.assertTrue(status.is_success(202))
def test_is_redirect(self):
self.assertTrue(status.is_redirect(304))
def test_is_client_error(self):
self.assertTrue(status.is_client_error(403))
def test_is_server_error(self):
self.assertTrue(status.is_server_error(500))
def test_200_ok(self):
self.assertEqual(status.HTTP_200_OK, 200)
# Dummy tests.
def test_all(self):
for k,v in vars(status).items():
self.assertEqual(vars(status).get(k), v)
def test_invalid_http_status_code(self):
with self.assertRaises(InvalidHTTPStatusCode):
status.describe(777)
if __name__ == "__main__":
unittest.main()