'Helper function for testing domain updates.'

def test_update(self, updateRecords=None):

    fake_dns_instance = FakeDnsInstance()
    t = template_format.parse(domain_only_template)
    instance = self._setup_test_cloud_dns_instance('dnsinstance_update', t)
    instance.resource_id = 4
    update_args = self.update_domain_only_args
    self._stubout_update(instance, fake_dns_instance, updateRecords, **update_args)
    uprops = dict(instance.properties)
    uprops.update({'emailAddress': 'updatedEmail@example.com', 'ttl': 5555, 'comment': 'updated    comment'})
    if updateRecords:
        uprops['records'] = updateRecords
    ut = rsrc_defn.ResourceDefinition(instance.name, instance.type(), uprops)
    instance.state_set(instance.CREATE, instance.COMPLETE)
    scheduler.TaskRunner(instance.update, ut)()
    self.assertEqual((instance.UPDATE, instance.COMPLETE), instance.state)
    self.m.VerifyAll()
