Exemplo n.º 1
0
 def test_GET_after_PUT(self):
     client = http.HttpClient()
     for i in range(10):
         path = self.URI_BASE + '/file.%(i)d.txt' % locals()
         client.PUT(path, self.RESPONSE + str(i))
         self.assertEquals(client.GET(path), self.RESPONSE + str(i))
Exemplo n.º 2
0
 def test_unauthenticated_POST(self):
     client = http.HttpClient()
     path = self.URI_BASE + '/auth'
     self.assertRaises(http.Unauthorized, client.POST, path, self.DUMMYDATA)
Exemplo n.º 3
0
 def test_PUT(self):
     client = http.HttpClient()
     path = self.URI_BASE + '/noauth'
     self.assertEquals(client.PUT(path, self.DUMMYDATA), 'PUT OK')
Exemplo n.º 4
0
 def test_POST(self):
     client = http.HttpClient()
     path = self.URI_BASE + '/noauth'
     self.assertEquals(client.POST(path, self.DUMMYDATA),
                       self.DUMMYDATA.encode('rot13'))
Exemplo n.º 5
0
 def test_authenticated_POST(self):
     client = http.HttpClient(self.USERNAME, self.PASSWORD)
     path = self.URI_BASE + '/auth'
     self.assertEquals(client.POST(path, self.DUMMYDATA),
                       self.DUMMYDATA.encode('rot13'))
Exemplo n.º 6
0
 def test_authenticated_GET(self):
     client = http.HttpClient(self.USERNAME, self.PASSWORD)
     path = self.URI_BASE + '/auth'
     self.assertEquals(client.GET(path), self.RESPONSE)
Exemplo n.º 7
0
 def test_unauthenticated_GET(self):
     client = http.HttpClient()
     path = self.URI_BASE + '/auth'
     self.assertRaises(http.Unauthorized, client.GET, path)
Exemplo n.º 8
0
 def test_GET(self):
     client = http.HttpClient()
     path = self.URI_BASE + '/noauth'
     self.assertEquals(client.GET(path), self.RESPONSE)
Exemplo n.º 9
0
 def test_BadRequest(self):
     client = http.HttpClient()
     path = self.URI_BASE + '/badrequest'
     self.assertRaises(http.BadRequest, client.GET, path)
Exemplo n.º 10
0
 def test_Unauthorized(self):
     client = http.HttpClient('invalid-username', 'invalid-password')
     path = self.URI_BASE + '/auth'
     self.assertRaises(http.Unauthorized, client.GET, path)
Exemplo n.º 11
0
 def test_NotFound(self):
     client = http.HttpClient()
     path = self.URI_BASE + '/notfound'
     self.assertRaises(http.NotFound, client.GET, path)
Exemplo n.º 12
0
 def test_UnknownResponse(self):
     client = http.HttpClient()
     path = self.URI_BASE + '/invaliderror'
     self.assertRaises(http.UnknownResponse, client.GET, path)