Пример #1
0
 def test_dict(self):
     """Check conversion of simple XML to dict."""
     xml = get_xml_from_file('dict.xml')
     xml_dict = xml_string_to_dict(xml)
     expected_dict = {'Bar': '1',
                      'Qux': '2'}
     self.assertEqual(xml_dict, expected_dict)
Пример #2
0
    def _call_mollie(self, data,):
        """Call the Mollie API and return a dict with the result.

        The ``data`` dict should contain all the parameters we will
        send to Mollie.

        """
        result_str = self._do_request(data)
        result_dict = xml_string_to_dict(result_str)
        if 'item' in result_dict and \
           result_dict['item'].get('type') == 'error':
            raise MollieAPIError(result_dict['item']['errorcode'],
                                 result_dict['item']['message'])
        return result_dict