예제 #1
0
 def test_metadata_deserializer(self):
     """Should throw a 400 error on corrupt xml."""
     deserializer = common.MetadataXMLDeserializer()
     self.assertRaises(
             exception.MalformedRequestBody,
             deserializer.deserialize,
             utils.killer_xml_body())
예제 #2
0
    def test_get_method_action_corrupt_xml(self):
        class Controller(wsgi.Controller):
            @wsgi.action('fooAction')
            def _action_foo(self, req, id, body):
                return body

        controller = Controller()
        resource = wsgi.Resource(controller)
        self.assertRaises(exception.MalformedRequestBody, resource.get_method,
                          None, 'action', 'application/xml',
                          utils.killer_xml_body())
예제 #3
0
    def test_safe_parse_xml(self):

        normal_body = ('<?xml version="1.0" ?>'
                       '<foo><bar><v1>hey</v1><v2>there</v2></bar></foo>')

        dom = xmlutil.safe_minidom_parse_string(normal_body)
        # Some versions of minidom inject extra newlines so we ignore them
        result = str(dom.toxml()).replace('\n', '')
        self.assertEqual(normal_body, result)

        self.assertRaises(exception.MalformedRequestBody,
                          xmlutil.safe_minidom_parse_string,
                          tests_utils.killer_xml_body())
예제 #4
0
파일: test_wsgi.py 프로젝트: EdLeafe/nova
    def test_get_method_action_corrupt_xml(self):
        class Controller(wsgi.Controller):
            @wsgi.action('fooAction')
            def _action_foo(self, req, id, body):
                return body

        controller = Controller()
        resource = wsgi.Resource(controller)
        self.assertRaises(
                exception.MalformedRequestBody,
                resource.get_method,
                None, 'action',
                'application/xml',
                utils.killer_xml_body())
예제 #5
0
파일: test_cells.py 프로젝트: FengYang/nova
 def test_with_corrupt_xml(self):
     deserializer = cells_ext_v2.CellDeserializer()
     self.assertRaises(
             exception.MalformedRequestBody,
             deserializer.deserialize,
             utils.killer_xml_body())
예제 #6
0
 def test_with_corrupt_xml(self):
     deserializer = cells_ext_v2.CellDeserializer()
     self.assertRaises(exception.MalformedRequestBody,
                       deserializer.deserialize, utils.killer_xml_body())
예제 #7
0
파일: test_hosts.py 프로젝트: FengYang/nova
 def test_corrupt_xml(self):
     self.assertRaises(
             exception.MalformedRequestBody,
             self.deserializer.deserialize,
             utils.killer_xml_body())
예제 #8
0
 def test_corrupt_xml(self):
     self.assertRaises(exception.MalformedRequestBody,
                       self.deserializer.deserialize,
                       utils.killer_xml_body())
예제 #9
0
 def test_corrupt_xml(self):
     """Should throw a 400 error on corrupt xml."""
     self.assertRaises(exception.MalformedRequestBody,
                       self.deserializer.deserialize,
                       utils.killer_xml_body())
예제 #10
0
 def test_corrupt_xml(self):
     """Should throw a 400 error on corrupt xml."""
     self.assertRaises(
             exception.MalformedRequestBody,
             self.deserializer.deserialize,
             utils.killer_xml_body())