def testFetchImagesGoodWithOneSetOfFilesAndNotFsi(self): """Fetch success for one set of recovery/release files and non-FSI.""" self.options.fsi = False self.options.recovery2 = None self.options.release2 = None absfactorybin = 'absfactorybin' shim_name = 'shim_name' expected = dict(ssd=self.rel_name, ssd2=None, recovery=self.rec_name, recovery2=None, factorybin=absfactorybin, shim=shim_name) cros_bundle_lib._GetResourceUrlAndPath( mox.IgnoreArg(), cros_bundle_lib.GetReleaseName, self.options.board, self.options.release, 0).AndReturn((self.rel_url, self.rel_name)) cros_bundle_lib._HandleFactoryImageAndShim( self.options, 0).AndReturn((absfactorybin, shim_name)) self.mox.ReplayAll() self.assertEqual(expected, cros_bundle_lib.FetchImages(self.options))
def testHandleFactoryImageAndShimGoodNoDownloadNoExtract(self): """Verify success with no image download or extraction.""" expected = (self.absfactorybin, self.shim_name) cros_bundle_lib.DetermineUrl( self.fac_url, self.fac_pat).AndReturn(self.fac_det_url) os.path.exists(self.fac_name).AndReturn(True) os.path.exists(self.absfactorybin).AndReturn(True) cros_bundle_lib.GetShimName( self.options.board, self.options.shim, self.alt_naming).AndReturn( (None, self.shim_pat)) cros_bundle_lib.DetermineThenDownloadCheckMd5( self.fac_url, self.shim_pat, WORKDIR, mox.IgnoreArg()).AndReturn( self.shim_name) self.mox.ReplayAll() actual = cros_bundle_lib._HandleFactoryImageAndShim(self.options, self.alt_naming) self.assertEqual(expected, actual)