def test_from_xml_calls_prep_attributes_and_check_if_object_fetched( self, prep_attributes_patch, check_if_object_fetched_patch): b = BroadsoftObject() prep_attributes_patch.called = False check_if_object_fetched_patch.called = False b.from_xml() self.assertTrue(prep_attributes_patch.called) self.assertTrue(check_if_object_fetched_patch.called)
def from_xml(self, get_devices=True): BroadsoftObject.from_xml(self) self.devices = list() if self.xml: cmd = self.xml.findall('command')[0] if cmd.findall('phoneNumber'): self.did = cmd.findall('phoneNumber')[0].text if cmd.findall('firstName'): self.first_name = cmd.findall('firstName')[0].text if cmd.findall('lastName'): self.last_name = cmd.findall('lastName')[0].text if cmd.findall('extension'): self.extension = cmd.findall('extension')[0].text if cmd.findall('defaultAlias'): self.sip_user_id = cmd.findall('defaultAlias')[0].text if cmd.findall('emailAddress'): self.email = cmd.findall('emailAddress')[0].text if get_devices: self.load_devices()