[web/test] add a test for some http response codes
authorJulien Cristau <julien.cristau@logilab.fr>
Tue, 08 Apr 2014 16:12:39 +0200
changeset 9730 8347e6d613c9
parent 9728 f79ce7b39ee9
child 9736 e0b3fcf1c205
[web/test] add a test for some http response codes Related to #3648809
web/test/unittest_web.py
--- a/web/test/unittest_web.py	Thu Mar 13 17:03:15 2014 +0100
+++ b/web/test/unittest_web.py	Tue Apr 08 16:12:39 2014 +0200
@@ -102,6 +102,18 @@
         webreq = self.web_request(headers=headers)
         self.assertIn('lang="en"', webreq.read())
 
+    def test_response_codes(self):
+        with self.admin_access.client_cnx() as cnx:
+            admin_eid = cnx.user.eid
+        # guest can't see admin
+        webreq = self.web_request('/%d' % admin_eid)
+        self.assertEqual(webreq.status, 403)
+
+        # but admin can
+        self.web_login()
+        webreq = self.web_request('/%d' % admin_eid)
+        self.assertEqual(webreq.status, 200)
+
 
 if __name__ == '__main__':
     unittest_main()