def testListRemoteBinhost(self): """Check that urls are generated correctly for remote binhosts.""" chaps_cpv = 'chromeos-base/chaps-0-r2' metrics_cpv = 'chromeos-base/metrics-0-r4' index = SimpleIndex({}, [{ 'CPV': 'chromeos-base/shill-0-r1' }, { 'CPV': chaps_cpv, 'DEBUG_SYMBOLS': 'yes' }, { 'CPV': metrics_cpv, 'DEBUG_SYMBOLS': 'yes', 'PATH': 'path/to/binpkg.tbz2' }]) self.PatchObject(cros_install_debug_syms, 'GetPackageIndex', return_value=index) for binhost in self.remote_binhosts: expected = { chaps_cpv: os.path.join(binhost, chaps_cpv + '.debug.tbz2'), metrics_cpv: os.path.join(binhost, 'path/to/binpkg.debug.tbz2') } self.assertEquals(cros_install_debug_syms.ListBinhost(binhost), expected)
def testListRemoteBinhostWithURI(self): """Check that urls are generated correctly when URI is defined.""" index = SimpleIndex( {'URI': 'gs://chromeos-prebuilts'}, [{ 'CPV': 'chromeos-base/shill-0-r1', 'DEBUG_SYMBOLS': 'yes', 'PATH': 'amd64-generic/paladin1234/shill-0-r1.tbz2' }]) self.PatchObject(cros_install_debug_syms, 'GetPackageIndex', return_value=index) binhost = 'gs://chromeos-prebuilts/gizmo-paladin/' debug_symbols_url = ('gs://chromeos-prebuilts/amd64-generic' '/paladin1234/shill-0-r1.debug.tbz2') self.assertEquals(cros_install_debug_syms.ListBinhost(binhost), {'chromeos-base/shill-0-r1': debug_symbols_url})