コード例 #1
0
 def _compare_aws_xml(self, root_tag, xmlns, request_id, dict_data,
                      observed):
     # NOTE(ft): we cann't use matchers.XMLMatches since it makes comparison
     # based on the order of tags
     xml = etree.fromstring(observed)
     self.assertEqual(xmlns, xml.nsmap.get(None))
     observed_data = tools.parse_xml(observed)
     expected = {root_tag: tools.update_dict(dict_data,
                                             {'requestId': request_id})}
     self.assertThat(observed_data, matchers.DictMatches(expected))
コード例 #2
0
 def _compare_aws_xml(self, root_tag, xmlns, request_id, dict_data,
                      observed):
     # NOTE(ft): we cann't use matchers.XMLMatches since it makes comparison
     # based on the order of tags
     xml = etree.fromstring(observed)
     self.assertEqual(xmlns, xml.nsmap.get(None))
     observed_data = tools.parse_xml(observed)
     expected = {root_tag: tools.update_dict(dict_data,
                                             {'requestId': request_id})}
     self.assertThat(observed_data, matchers.DictMatches(expected))
コード例 #3
0
ファイル: base.py プロジェクト: JioCloudCompute/ec2-api
 def _check_and_transform_response(self, response, action):
     body = tools.parse_xml(response.body)
     if response.status_code == 200:
         action_tag = '%sResponse' % action
         self.assertIn(action_tag, body)
         body = body.pop(action_tag)
         self.assertIn('requestId', body)
         body.pop('requestId')
     else:
         self.assertIn('Response', body)
         body = body.pop('Response')
         self.assertIn('RequestID', body)
         body.pop('RequestID')
         self.assertEqual(1, len(body))
         self.assertIn('Errors', body)
         body = body.pop('Errors')
         self.assertEqual(1, len(body))
         self.assertIn('Error', body)
         self.assertEqual(2, len(body['Error']))
     return body
コード例 #4
0
 def _check_and_transform_response(self, response, action):
     body = tools.parse_xml(response.body)
     if response.status_code == 200:
         action_tag = '%sResponse' % action
         self.assertIn(action_tag, body)
         body = body.pop(action_tag)
         self.assertIn('requestId', body)
         body.pop('requestId')
     else:
         self.assertIn('Response', body)
         body = body.pop('Response')
         self.assertIn('RequestID', body)
         body.pop('RequestID')
         self.assertEqual(1, len(body))
         self.assertIn('Errors', body)
         body = body.pop('Errors')
         self.assertEqual(1, len(body))
         self.assertIn('Error', body)
         self.assertEqual(2, len(body['Error']))
     return body