Esempio n. 1
0
 def testFindAndVerifyPartitionsAndImages_noFile_NotRequiredImageAB(self):
     with mock.patch('os.listdir', return_value=['test']):
         self.assertFalse(
             fastboot_utils._FindAndVerifyPartitionsAndImages(['vendor'],
                                                              'test', True))
         self.assertFalse(
             fastboot_utils._FindAndVerifyPartitionsAndImages(['cache'],
                                                              'test', True))
Esempio n. 2
0
    def testFindAndVerifyPartitionsAndImages_noFile_RequiredImageAB(self):
        with mock.patch('os.listdir', return_value=['test']):
            with self.assertRaises(device_errors.FastbootCommandFailedError):
                fastboot_utils._FindAndVerifyPartitionsAndImages(['boot'],
                                                                 'test', True)

            with self.assertRaises(device_errors.FastbootCommandFailedError):
                fastboot_utils._FindAndVerifyPartitionsAndImages(['dtbo'],
                                                                 'test', True)
Esempio n. 3
0
 def testFindAndVerifyPartitionsAndImages_validNoVendor(self):
   PARTITIONS = [
       'bootloader', 'radio', 'boot', 'recovery', 'system', 'userdata',
       'cache', 'vendor'
   ]
   files = [
       'bootloader-test-.img',
       'radio123.img',
       'boot.img',
       'recovery.img',
       'system.img',
       'userdata.img',
       'cache.img'
   ]
   img_check = collections.OrderedDict([
     ('bootloader', 'test/bootloader-test-.img'),
     ('radio', 'test/radio123.img'),
     ('boot', 'test/boot.img'),
     ('recovery', 'test/recovery.img'),
     ('system', 'test/system.img'),
     ('userdata', 'test/userdata.img'),
     ('cache', 'test/cache.img'),
   ])
   parts_check = [
       'bootloader', 'radio', 'boot', 'recovery', 'system', 'userdata',
       'cache'
   ]
   with mock.patch('os.listdir', return_value=files):
     imgs = fastboot_utils._FindAndVerifyPartitionsAndImages(
         PARTITIONS, 'test')
     parts = imgs.keys()
     self.assertDictEqual(imgs, img_check)
     self.assertListEqual(parts, parts_check)
 def testFindAndVerifyPartitionsAndImages_validNoVendor(self):
   PARTITIONS = [
       'bootloader', 'radio', 'boot', 'recovery', 'system', 'userdata',
       'cache', 'vendor'
   ]
   files = [
       'bootloader-test-.img',
       'radio123.img',
       'boot.img',
       'recovery.img',
       'system.img',
       'userdata.img',
       'cache.img'
   ]
   img_check = collections.OrderedDict([
     ('bootloader', 'test/bootloader-test-.img'),
     ('radio', 'test/radio123.img'),
     ('boot', 'test/boot.img'),
     ('recovery', 'test/recovery.img'),
     ('system', 'test/system.img'),
     ('userdata', 'test/userdata.img'),
     ('cache', 'test/cache.img'),
   ])
   parts_check = [
       'bootloader', 'radio', 'boot', 'recovery', 'system', 'userdata',
       'cache'
   ]
   with mock.patch('os.listdir', return_value=files):
     imgs = fastboot_utils._FindAndVerifyPartitionsAndImages(
         PARTITIONS, 'test')
     parts = imgs.keys()
     self.assertDictEqual(imgs, img_check)
     self.assertListEqual(parts, parts_check)
Esempio n. 5
0
 def testFindAndVerifyPartitionsAndImages_badPartition(self):
   with mock.patch('os.listdir', return_value=['test']):
     with self.assertRaises(KeyError):
       fastboot_utils._FindAndVerifyPartitionsAndImages(['test'], 'test')
 def testFindAndVerifyPartitionsAndImages_noFile(self):
     with mock.patch('os.listdir', return_value=['test']):
         with self.assertRaises(device_errors.FastbootCommandFailedError):
             fastboot_utils._FindAndVerifyPartitionsAndImages(['cache'],
                                                              'test',
                                                              'board_type')
 def testFindAndVerifyPartitionsAndImages_noFile(self):
   with mock.patch('os.listdir', return_value=['test']):
     with self.assertRaises(device_errors.FastbootCommandFailedError):
       fastboot_utils._FindAndVerifyPartitionsAndImages(['cache'], 'test')
 def testFindAndVerifyPartitionsAndImages_badPartition(self):
   with mock.patch('os.listdir', return_value=['test']):
     with self.assertRaises(KeyError):
       fastboot_utils._FindAndVerifyPartitionsAndImages(['test'], 'test')