Commits

Hong Minhee committed 265b536

Added tests for Python object interfaces of resources.

Comments (0)

Files changed (1)

     def setUp(self):
         self.rsc = TestResource("root")
 
-    def test_root(self):
+    def test_root_get(self):
+        self.assertEquals(
+            {"message": "GET method test"},
+            self.rsc.get_method_test()
+        )
         self.assertEquals(
             "GET method test",
             self.rsc(Request("GET / HTTP/1.1\r\n\r\n")).body
         )
+
+    def test_root_post(self):
+        self.assertEquals(
+            {"message": "root"},
+            self.rsc.post_method_test()
+        )
         self.assertEquals(
             "root",
             self.rsc(Request("POST / HTTP/1.1\r\n\r\n")).body
         )
+
+    def test_root_put(self):
         self.assertEquals(
             "PUT: root /",
             self.rsc(Request("PUT / HTTP/1.1\r\n\r\n")).body
         )
+
+    def test_root_custom(self):
+        self.assertEquals(
+            {"message": "CUSTOM method test"},
+            self.rsc.custom_method_test()
+        )
         self.assertEquals(
             "CUSTOM method test",
             self.rsc(Request("CUSTOM / HTTP/1.1\r\n\r\n")).body
         )
+
+    def test_root_error(self):
         for method in ["DELETE", "UNDef"]:
             response = self.rsc(Request(method + " / HTTP/1.1\r\n\r\n"))
             self.assertTrue(