[autotest] Deserializer: Allow updating objects

Currently the state of an object is never changed by the
deserializer.

After a shard executed a job, the master should be informed
about it's result so one can see if a job has been executed or not
in one central place for all jobs.

To update a job's status on the master, this is necessary.

Doing this, a bug of the previous implementation became apparent:
Deserializing a host object while no AclGroups were present yet
would create an Everyone-AclGroup in it's save() method. This is
dangerous because this way the states of master and shards might
diverge, specifically AclGroups with same names and different ids
might occur, which will then, upon dumping the Everyone-AclGroup from
the master, will cause exceptions to be raised.

Therefore just not running them prevents errors.

BUG=None
DEPLOY=scheduler,apache,host_scheduler
TEST=Ran suites, tested with real data on shard

Change-Id: Ie8ccd3205ac0efd5bbba4402da5de4c2615b495c
Reviewed-on: https://chromium-review.googlesource.com/218806
Reviewed-by: Prashanth B <beeps@chromium.org>
Commit-Queue: Jakob Jülich <jakobjuelich@chromium.org>
Tested-by: Jakob Jülich <jakobjuelich@chromium.org>
diff --git a/frontend/afe/models_test.py b/frontend/afe/models_test.py
index b19eef3..83ffadd 100755
--- a/frontend/afe/models_test.py
+++ b/frontend/afe/models_test.py
@@ -586,5 +586,21 @@
                          self._get_example_response())
 
 
+    def test_update(self):
+        job = self._create_job(hosts=[1])
+        serialized = job.serialize(include_dependencies=False)
+        serialized['owner'] = 'some_other_owner'
+
+        job.update_from_serialized(serialized)
+        self.assertEqual(job.owner, 'some_other_owner')
+
+        serialized = job.serialize()
+        self.assertRaises(
+            ValueError,
+            job.update_from_serialized, serialized)
+
+
+
+
 if __name__ == '__main__':
     unittest.main()