Esempio n. 1
0
 def test_process_response_create_correct_json_body(self):
     req = FakeReqResp()
     d = {'key1': 'value1', 'key2': 'value2'}
     req.context['result'] = d
     correct_json_body = json.dumps(d)
     self.json_translator.process_response(req, req, None)
     self.assertEqual(correct_json_body, req.body)
Esempio n. 2
0
 def setUp(self):
     self.resource = versions.Resource()
     self.req = FakeReqResp()
Esempio n. 3
0
 def setUp(self):
     self.resource = v1.homedoc.Resource()
     self.req = FakeReqResp()
Esempio n. 4
0
 def test_process_request_with_positive_length_and_no_body_raises(self):
     req = FakeReqResp()
     req.content_length = 1
     self.assertRaises(falcon.HTTPBadRequest, self.json_translator.process_request, req, req)