Ejemplo n.º 1
0
 def test_parseResponse_worksWithIntegerList(self):
     client = json.JsonClient(self.USERNAME, self.PASSWORD)
     self.mock_setHttpResponse('[1,2,3,6,7]')
     self.assertEquals(client.GET('/'), [1,2,3,6,7])
Ejemplo n.º 2
0
 def test_invalidContent_raisesJsonException(self):
     client = json.JsonClient(self.USERNAME, self.PASSWORD)
     self.mock_setHttpResponse(b'this is not a valid json string')
     self.assertRaises(json.JsonException, client.GET, self.URI_BASE + '/')
Ejemplo n.º 3
0
 def test_parseResponse_worksWithDictionary(self):
     client = json.JsonClient(self.USERNAME, self.PASSWORD)
     self.mock_setHttpResponse('{"a": "B", "c": "D"}')
     items = list(sorted(client.GET('/').items()))
     self.assertEquals(items, [('a', 'B'), ('c', 'D')])
Ejemplo n.º 4
0
 def test_parseResponse_emptyString_returnsNone(self):
     client = json.JsonClient(self.USERNAME, self.PASSWORD)
     self.mock_setHttpResponse(b'')
     self.assertEquals(client.GET(self.URI_BASE + '/'), None)