def testGetLatestRelease(self): """Tests if we can find the latest release from our mock url data.""" TEST_HOST = 'sores.chromium.org' TEST_URL = 'phthp://%s/tqs' % TEST_HOST TEST_TAGS = [ '7.0.224.1', '7.0.224', '8.0.365.5', 'foo', 'bar-12.13.14.15' ] TEST_REFS_JSON = dict((tag, None) for tag in TEST_TAGS) TEST_BAD_DEPS_CONTENT = dedent("""\ buildspec_platforms: 'TRS-80,', """).encode('utf-8') TEST_GOOD_DEPS_CONTENT = dedent("""\ buildspec_platforms: 'chromeos,', """).encode('utf-8') self.PatchObject(gob_util, 'FetchUrl', side_effect=( base64.b64encode(TEST_BAD_DEPS_CONTENT), base64.b64encode(TEST_GOOD_DEPS_CONTENT), )) self.PatchObject(gob_util, 'FetchUrlJson', side_effect=(TEST_REFS_JSON, )) release = cros_mark_chrome_as_stable.GetLatestRelease(TEST_URL) self.assertEqual('7.0.224.1', release)
def GetLatestChromeVersion(self): """Returns the version of Chrome to uprev.""" return cros_mark_chrome_as_stable.GetLatestRelease( constants.CHROMIUM_GOB_URL)