nebraska: Break properties into two objects
There are typically two types of properties that nebraska is setup. One
is defined when the nebraska starts and never
changes (NebraskaProperties) and one can be changed during the lifetime
of the nebraska or be configured by each request (through function API
call or url query strings). This CL breaks these two kinds into two
separate objects so we can flexibly add new properties to each one of
them without too much code change, etc.
BUG=chromium:999047
TEST=cros flash
TEST=nebraska_unittest.py, auto_update_unittest.py
Change-Id: I4e7872f5659385bf31cf2c25bf3917564249df0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/1951506
Tested-by: Amin Hassani <ahassani@chromium.org>
Commit-Queue: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
diff --git a/autoupdate_unittest.py b/autoupdate_unittest.py
index 93e8b06..648ef7c 100755
--- a/autoupdate_unittest.py
+++ b/autoupdate_unittest.py
@@ -39,6 +39,7 @@
self.port = 8080
self.test_board = 'test-board'
self.build_root = tempfile.mkdtemp('autoupdate_build_root')
+ self.tempdir = tempfile.mkdtemp('tempdir')
self.latest_dir = '12345_af_12-a1'
self.latest_verision = '12345_af_12'
self.static_image_dir = tempfile.mkdtemp('autoupdate_static_dir')
@@ -59,6 +60,7 @@
def tearDown(self):
shutil.rmtree(self.build_root)
+ shutil.rmtree(self.tempdir)
shutil.rmtree(self.static_image_dir)
def _DummyAutoupdateConstructor(self, **kwargs):
@@ -92,6 +94,22 @@
self.assertEqual(
json.loads(au_mock.HandleHostInfoPing(test_ip)), self.test_dict)
+ @mock.patch.object(autoupdate.Autoupdate, 'GetPathToPayload')
+ def testHandleUpdatePing(self, path_to_payload_mock):
+ """Tests HandleUpdatePing"""
+ au_mock = self._DummyAutoupdateConstructor()
+ path_to_payload_mock.return_value = self.tempdir
+ request = """<?xml version="1.0" encoding="UTF-8"?>
+<request protocol="3.0">
+ <os version="Indy" platform="Chrome OS" sp="10323.52.0_x86_64"></os>
+ <app appid="platform" version="1.0.0" delta_okay="true"
+ track="stable-channel" board="eve">
+ <ping active="1" a="1" r="1"></ping>
+ <updatecheck targetversionprefix=""></updatecheck>
+ </app>
+</request>"""
+
+ self.assertIn('error-unknownApplication', au_mock.HandleUpdatePing(request))
if __name__ == '__main__':
unittest.main()