コード例 #1
0
 def test_send_bad_rds_bad(self, mock_di):
     req = mock.MagicMock()
     req.post.return_value = Response(204, "any cont")
     mock_di.resolver.unpack.return_value = req
     with self.assertRaises(Exception) as exp:
         rds_proxy.send_image({"not real": "only for test"}, "tran_id",
                              "any")
コード例 #2
0
 def test_send_rds_req_bad_resp(self, mock_request, mock_di):
     req = mock.MagicMock()
     req.post.return_value = Response(301, '{"faultstring": ":("}')
     mock_di.resolver.unpack.return_value = req
     with self.assertRaises(rds_proxy.ErrorStatus):
         rds_proxy.send_image({"not real": "only for test"}, "tran_id",
                              "post")
コード例 #3
0
 def test_send_delete_rds_success(self, mock_request, mock_di):
     req = mock.MagicMock()
     req.delete.return_value = Response(204, "any cont")
     mock_di.resolver.unpack.return_value = req
     result = rds_proxy.send_image({"not real": "only for test"}, "tran_id",
                                   "delete")
     self.assertEqual(result, {'res': 'any cont'})