def testGetTouchFirmwareFiles(self):
    def _GetFile(source, symlink):
      """Helper to return a suitable SymlinkedFile"""
      return SymlinkedFile(source, TOUCH_FIRMWARE + source,
                           LIB_FIRMWARE + symlink)

    config = CrosConfig(self.filepath)
    touch_files = config.GetConfig('another').GetTouchFirmwareFiles()
    # pylint: disable=line-too-long
    self.assertEqual(
        touch_files,
        [SymlinkedFile(source='some_stylus_vendor/another-version.hex',
                       dest='/opt/google/touch/firmware/some_stylus_vendor/another-version.hex',
                       symlink='/lib/firmware/some_stylus_vendor_firmware_ANOTHER.bin'),
         SymlinkedFile(source='some_touch_vendor/some-pid_some-version.bin',
                       dest='/opt/google/touch/firmware/some_touch_vendor/some-pid_some-version.bin',
                       symlink='/lib/firmware/some_touch_vendorts_i2c_some-pid.bin')])
    touch_files = config.GetConfig('some').GetTouchFirmwareFiles()

    # This checks that duplicate processing works correct, since both models
    # have the same wacom firmware
    self.assertEqual(
        touch_files,
        [SymlinkedFile(source='some_stylus_vendor/some-version.hex',
                       dest='/opt/google/touch/firmware/some_stylus_vendor/some-version.hex',
                       symlink='/lib/firmware/some_stylus_vendor_firmware_SOME.bin'),
         SymlinkedFile(source='some_touch_vendor/some-pid_some-version.bin',
                       dest='/opt/google/touch/firmware/some_touch_vendor/some-pid_some-version.bin',
                       symlink='/lib/firmware/some_touch_vendorts_i2c_some-pid.bin'),
         SymlinkedFile(source='some_touch_vendor/some-other-pid_some-other-version.bin',
                       dest='/opt/google/touch/firmware/some_touch_vendor/some-other-pid_some-other-version.bin',
                       symlink='/lib/firmware/some_touch_vendorts_i2c_some-other-pid.bin')])
    touch_files = config.GetTouchFirmwareFiles()
    expected = set(
        [SymlinkedFile(source='some_stylus_vendor/another-version.hex',
                       dest='/opt/google/touch/firmware/some_stylus_vendor/another-version.hex',
                       symlink='/lib/firmware/some_stylus_vendor_firmware_ANOTHER.bin'),
         SymlinkedFile(source='some_stylus_vendor/some-version.hex',
                       dest='/opt/google/touch/firmware/some_stylus_vendor/some-version.hex',
                       symlink='/lib/firmware/some_stylus_vendor_firmware_SOME.bin'),
         SymlinkedFile(source='some_touch_vendor/some-pid_some-version.bin',
                       dest='/opt/google/touch/firmware/some_touch_vendor/some-pid_some-version.bin',
                       symlink='/lib/firmware/some_touch_vendorts_i2c_some-pid.bin'),
         SymlinkedFile(source='some_touch_vendor/some-other-pid_some-other-version.bin',
                       dest='/opt/google/touch/firmware/some_touch_vendor/some-other-pid_some-other-version.bin',
                       symlink='/lib/firmware/some_touch_vendorts_i2c_some-other-pid.bin'),
         SymlinkedFile(source='some_touch_vendor/some-pid_some-version.bin',
                       dest='/opt/google/touch/firmware/some_touch_vendor/some-pid_some-version.bin',
                       symlink='/lib/firmware/some_touch_vendorts_i2c_some-pid.bin')])
    self.assertEqual(set(touch_files), expected)
Exemple #2
0
 def testGetFirmwareUris(self):
     config = CrosConfig(self.filepath)
     firmware_uris = config.GetConfig('another').GetFirmwareUris()
     self.assertSequenceEqual(
         firmware_uris,
         sorted(
             [ANOTHER_BUCKET + fname for fname in ANOTHER_FIRMWARE_FILES]))
 def testGetProperty(self):
   config = CrosConfig(self.filepath)
   another = config.GetConfig('another')
   self.assertEqual(another.GetProperty('/', 'wallpaper'), 'default')
   with self.assertRaises(Exception):
     another.GetProperty('/', 'missing')
 def testGetProperty(self):
   config = CrosConfig(self.filepath)
   another = config.GetConfig('another')
   self.assertEqual(another.GetProperty('/', 'wallpaper'), 'default')
   self.assertFalse(another.GetProperty('/', 'missing'))