'Test JSON message after XML import'

def testImportXML(self):

    assertEqual = self.assertEqual
    assertTrue = self.assertTrue
    xmlstr = '\n<s3xml>\n\n                <resource    name="pr_person">\n\n                                <data    field="first_name">Jason</data>\n                                <data    field="last_name">Test</data>\n                                <data    field="initials">JT</data>\n                                <data    field="date_of_birth"    value="1922-03-15"/>\n\n                                <resource    name="pr_contact">\n                                                <data    field="contact_method">EMAIL</data>\n                                                <data    field="value">json@example.com</data>\n                                </resource>\n\n                                <resource    name="pr_contact">\n                                                <data    field="contact_method">SMS</data>\n                                                <data    field="value">+123456789</data>\n                                </resource>\n\n                </resource>\n\n</s3xml>'
    xmltree = etree.ElementTree(etree.fromstring(xmlstr))
    resource = current.s3db.resource('pr_person')
    msg = resource.import_xml(xmltree)
    msg = json.loads(msg)
    assertEqual(msg['status'], 'success')
    assertEqual(msg['statuscode'], '200')
    assertEqual(msg['records'], 1)
    assertTrue(('created' in msg))
    assertTrue(isinstance(msg['created'], list))
    assertTrue((len(msg['created']) == 1))
