def testGetTipOfTrunkVersion(self): """Tests if we get the latest version from TOT.""" TEST_URL = 'proto://host.org/path/to/repo' TEST_VERSION_CONTENTS = dedent("""\ A=8 B=0 C=256 D=0""").encode('utf-8') result = base64.b64encode(TEST_VERSION_CONTENTS) self.PatchObject(gob_util, 'FetchUrl', return_value=result) # pylint: disable=protected-access version = cros_mark_chrome_as_stable._GetSpecificVersionUrl( TEST_URL, 'test-revision') self.assertEqual(version, '8.0.256.0')
def testGetTipOfTrunkVersion(self): """Tests if we get the latest version from TOT.""" TEST_URL = 'proto://host.org/path/to/repo' TEST_VERSION_CONTENTS = dedent('''\ A=8 B=0 C=256 D=0''') result = cStringIO.StringIO(base64.b64encode(TEST_VERSION_CONTENTS)) self.PatchObject(gob_util, 'FetchUrl', return_value=result) # pylint: disable=protected-access version = cros_mark_chrome_as_stable._GetSpecificVersionUrl( TEST_URL, 'test-revision') self.assertEquals(version, '8.0.256.0')
def testGetTipOfTrunkVersion(self): """Tests if we get the latest version from TOT.""" ARBITRARY_URL = 'Pratooey' path = os.path.join(cros_mark_chrome_as_stable._GetSvnUrl(ARBITRARY_URL), 'src', 'chrome', 'VERSION') self.mox.StubOutWithMock(cros_build_lib, 'RunCommand') cros_build_lib.RunCommand( ['svn', 'info', ARBITRARY_URL], redirect_stdout=True).AndReturn( _StubCommandResult( 'Some Junk 2134\nRevision: %s\nOtherInfo: test_data' % fake_svn_rev)) cros_build_lib.RunCommand( ['svn', 'cat', '-r', fake_svn_rev, path], redirect_stdout=True, error_message=mox.IsA(str)).AndReturn( _StubCommandResult('A=8\nB=0\nC=256\nD=0')) self.mox.ReplayAll() version = cros_mark_chrome_as_stable._GetSpecificVersionUrl(ARBITRARY_URL, fake_svn_rev) self.mox.VerifyAll() self.assertEquals(version, '8.0.256.0')