def parse_response(response_string): """Parse the response from an API method.""" doc = XML(response_string) error_code = doc.get("errorCode") if error_code is not None: raise UCSM_XML_API_Error(doc.get("errorDescr"), error_code) return doc
def test_no_children(self): fields = {"hello": "there"} request_data = make_request_data("foo", fields) root = XML(request_data) self.assertEqual("foo", root.tag) self.assertEqual("there", root.get("hello"))
def test_no_children(self): fields = {'hello': 'there'} request_data = make_request_data('foo', fields) root = XML(request_data) self.assertEqual('foo', root.tag) self.assertEqual('there', root.get('hello'))