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_object_attribute_error(self): # Because as_object() returns a proxy in order to avoid circular # imports, we actually have to call the return value of as_object() in # order to trigger the module lookup. self.assertRaises( AttributeError, as_object('systemimage.tests.test_helpers.NoSuchTest'))
def test_as_object_not_equal(self): self.assertNotEqual(as_object('systemimage.bag.Bag'), object())
def test_as_object_import_error(self): # Because as_object() returns a proxy in order to avoid circular # imports, we actually have to call the return value of as_object() in # order to trigger the module lookup. self.assertRaises(ImportError, as_object('systemimage.doesnotexist.Foo'))
def test_as_object_good_path(self): self.assertEqual(as_object('systemimage.bag.Bag'), Bag)