devtools/test/unittest_httptest.py
changeset 6366 1806148d6ce8
parent 6340 470d8e828fda
child 6424 f443a2b8a5c7
equal deleted inserted replaced
6333:e3994fcc21c3 6366:1806148d6ce8
    13         except httplib.NotConnected, ex:
    13         except httplib.NotConnected, ex:
    14             self.fail("Can't connection to test server: %s" % ex)
    14             self.fail("Can't connection to test server: %s" % ex)
    15 
    15 
    16     def test_response_anon(self):
    16     def test_response_anon(self):
    17         response = self.web_get()
    17         response = self.web_get()
    18         self.assertEquals(response.status, httplib.OK)
    18         self.assertEqual(response.status, httplib.OK)
    19 
    19 
    20 
    20 
    21     def test_base_url(self):
    21     def test_base_url(self):
    22         if self.test_url not in self.web_get().read():
    22         if self.test_url not in self.web_get().read():
    23             self.fail('no mention of base url in retrieved page')
    23             self.fail('no mention of base url in retrieved page')
    27 
    27 
    28     anonymous_logged = False
    28     anonymous_logged = False
    29 
    29 
    30     def test_response_denied(self):
    30     def test_response_denied(self):
    31         response = self.web_get()
    31         response = self.web_get()
    32         self.assertEquals(response.status, httplib.FORBIDDEN)
    32         self.assertEqual(response.status, httplib.FORBIDDEN)
    33 
    33 
    34     def test_login(self):
    34     def test_login(self):
    35         response = self.web_get()
    35         response = self.web_get()
    36         if response.status != httplib.FORBIDDEN:
    36         if response.status != httplib.FORBIDDEN:
    37              self.skip('Already authenticated')
    37              self.skipTest('Already authenticated')
    38         # login
    38         # login
    39         self.web_login(self.admlogin, self.admpassword)
    39         self.web_login(self.admlogin, self.admpassword)
    40         response = self.web_get()
    40         response = self.web_get()
    41         self.assertEquals(response.status, httplib.OK, response.body)
    41         self.assertEqual(response.status, httplib.OK, response.body)
    42         # logout
    42         # logout
    43         self.web_logout()
    43         self.web_logout()
    44         response = self.web_get()
    44         response = self.web_get()
    45         self.assertEquals(response.status, httplib.FORBIDDEN, response.body)
    45         self.assertEqual(response.status, httplib.FORBIDDEN, response.body)
    46 
    46 
    47 
    47 
    48 
    48 
    49 
    49 
    50 if __name__ == '__main__':
    50 if __name__ == '__main__':