def _set_defaults(self): self.service = Bag( base='system-image.ubports.com', http_port=80, https_port=443, channel='daily', build_number=0, ) self.system = Bag( timeout=as_timedelta('1h'), tempdir='/tmp', logfile='/var/log/system-image/client.log', loglevel=as_loglevel('info'), settings_db='/var/lib/system-image/settings.db', ) self.gpg = Bag( archive_master='/usr/share/system-image/archive-master.tar.xz', image_master='/var/lib/system-image/keyrings/image-master.tar.xz', image_signing='/var/lib/system-image/keyrings/image-signing.tar.xz', device_signing= '/var/lib/system-image/keyrings/device-signing.tar.xz', ) self.updater = Bag( cache_partition='/android/cache/recovery', data_partition='/var/lib/system-image', ) self.hooks = Bag( device=as_object('systemimage.device.SystemProperty'), scorer=as_object('systemimage.scores.WeightedScorer'), apply=as_object('systemimage.apply.Reboot'), ) self.dbus = Bag(lifetime=as_timedelta('10m'), )
def test_as_timedelta_float(self): self.assertEqual(as_timedelta('0.5d'), timedelta(hours=12))
def test_as_timedelta_minutes(self): self.assertEqual(as_timedelta('10m'), timedelta(seconds=600))
def test_as_timedelta_seconds(self): self.assertEqual(as_timedelta('2s'), timedelta(seconds=2))