[autotest] Allow updating selected model attributes

Right now, objects that have been persisted on the client once,
will never be overwritten again with new data, that comes from
the master.

In order to sync i.e. aborted bits from the master to the slave,
this needs to change.

This introduces a new variable SERIALIZATION_LOCAL_LINKS_TO_UPDATE,
which objects can overwrite with a set of names of attributes,
that should be overwritten with data that's sent from the master.

BUG=None
DEPLOY=shard_client
TEST=Ran suites.

Change-Id: I6b461475116db0acd2de7b8fe628aed791e7c418
Reviewed-on: https://chromium-review.googlesource.com/220331
Tested-by: Jakob Jülich <jakobjuelich@chromium.org>
Reviewed-by: Fang Deng <fdeng@chromium.org>
Commit-Queue: Jakob Jülich <jakobjuelich@chromium.org>
diff --git a/frontend/afe/models_test.py b/frontend/afe/models_test.py
index 83ffadd..5c074d0 100755
--- a/frontend/afe/models_test.py
+++ b/frontend/afe/models_test.py
@@ -600,6 +600,18 @@
             job.update_from_serialized, serialized)
 
 
+    def test_sync_aborted(self):
+        job = self._create_job(hosts=[1])
+        serialized = job.serialize()
+
+        serialized['hostqueueentry_set'][0]['aborted'] = True
+        serialized['hostqueueentry_set'][0]['status'] = 'Running'
+
+        models.Job.deserialize(serialized)
+
+        job = models.Job.objects.get(pk=job.id)
+        self.assertTrue(job.hostqueueentry_set.all()[0].aborted)
+        self.assertEqual(job.hostqueueentry_set.all()[0].status, 'Queued')
 
 
 if __name__ == '__main__':