Commit 21fb824e authored by Andrii Shyshkalov's avatar Andrii Shyshkalov Committed by Commit Bot

Gerrit git cl: add description cache handling regression test.

Follow up on https://chromium-review.googlesource.com/#/c/439877/
which fixed a bug.

R=kbr@chromium.org
BUG=688765

Change-Id: I8cfc5feb2d8060182572b2d4ecb6a038bf1e0abf
Reviewed-on: https://chromium-review.googlesource.com/443350Reviewed-by: 's avatarKenneth Russell <kbr@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
parent 61e2ed43
......@@ -2854,6 +2854,26 @@ class TestGitCl(TestCase):
self.assertEqual(cl._GetChangeDetail(options=['A'], no_cache=True), 'a')
self.assertEqual(cl._GetChangeDetail(options=['B']), 'b')
def test_gerrit_description_caching(self):
def gen_detail(rev, desc):
return {
'current_revision': rev,
'revisions': {rev: {'commit': {'message': desc}}}
}
self.calls = [
(('GetChangeDetail', 'host', '1',
['CURRENT_REVISION', 'CURRENT_COMMIT']),
gen_detail('rev1', 'desc1')),
(('GetChangeDetail', 'host', '1',
['CURRENT_REVISION', 'CURRENT_COMMIT']),
gen_detail('rev2', 'desc2')),
]
self._mock_gerrit_changes_for_detail_cache()
cl = git_cl.Changelist(issue=1, codereview='gerrit')
self.assertEqual(cl.GetDescription(), 'desc1')
self.assertEqual(cl.GetDescription(), 'desc1') # cache hit.
self.assertEqual(cl.GetDescription(force=True), 'desc2')
if __name__ == '__main__':
logging.basicConfig(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment