'Test that validator for mobile phone number is applied during import'

def testMobilePhoneNumberImportValidationInternational(self):

    s3db = current.s3db
    current.deployment_settings.msg.require_international_phone_numbers = True
    xmlstr = '\n<s3xml>\n                <resource    name="pr_person"    uuid="CONTACTVALIDATORTESTPERSON2">\n                                <data    field="first_name">ContactValidatorTestPerson2</data>\n                                <resource    name="pr_contact"    uuid="VALIDATORTESTCONTACT1">\n                                                <data    field="contact_method">SMS</data>\n                                                <data    field="value">0368172634</data>\n                                </resource>\n                                <resource    name="pr_contact"    uuid="VALIDATORTESTCONTACT2">\n                                                <data    field="contact_method">SMS</data>\n                                                <data    field="value">+46-73-3847589</data>\n                                </resource>\n                </resource>\n</s3xml>'
    xmltree = etree.ElementTree(etree.fromstring(xmlstr))
    resource = s3db.resource('pr_person')
    result = resource.import_xml(xmltree, ignore_errors=True)
    resource = s3db.resource('pr_contact', uid='VALIDATORTESTCONTACT1')
    self.assertEqual(resource.count(), 0)
    row = resource.select(['value'], as_rows=True).first()
    self.assertEqual(row, None)
    resource = s3db.resource('pr_contact', uid='VALIDATORTESTCONTACT2')
    self.assertEqual(resource.count(), 1)
    row = resource.select(['value'], as_rows=True).first()
    self.assertNotEqual(row, None)
    self.assertEqual(row.value, '+46733847589')
