def METHOD_NAME(self):
    xml_data = base64.b64encode(
        b"<?xml version='1.0' encoding='utf-8'?><root><foo>baz</foo></root>"
    )
    # Simulate bad file handling
    mock_parse_xml = mock.patch.object(type(self.wiz_model), "_parse_xml")
    with Form(self.wiz_model) as form:
        form.order_filename = "test.xml"
        with mock_parse_xml as mocked:
            mocked.return_value = ("", "I don't like this file")
            with self.assertRaisesRegex(
                exceptions.UserError, "I don't like this file"
            ):
                form.order_file = xml_data
            mocked.assert_called()
    mock_parse_order = mock.patch.object(type(self.wiz_model), "parse_xml_order")
    with Form(self.wiz_model) as form:
        form.order_filename = "test.xml"
        with mock_parse_order as mocked:
            mocked.return_value = "rfq"
            form.order_file = xml_data
            mocked.assert_called()
            self.assertFalse(form.csv_import)
            self.assertEqual(form.doc_type, "rfq")