From 0f790421b29596227054e934c0add868e385d0d9 Mon Sep 17 00:00:00 2001 From: Gavin Mak Date: Mon, 1 Feb 2021 19:06:37 +0000 Subject: [PATCH] Update ListOwners for GerritClient in owners_client The REST endpoint used by GerritClient.ListOwners needs to be updated as of https://gerrit-review.googlesource.com/c/plugins/code-owners/+/293806 Change-Id: I5c142f16443b157c9d8edfa5bcf418cbedd2b193 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2658609 Reviewed-by: Edward Lesmes Commit-Queue: Gavin Mak --- owners_client.py | 2 +- tests/owners_client_test.py | 32 +++++++++++++++++--------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/owners_client.py b/owners_client.py index fed27af79..0d2f5052d 100644 --- a/owners_client.py +++ b/owners_client.py @@ -203,4 +203,4 @@ class GerritClient(OwnersClient): # random. data = gerrit_util.GetOwnersForFile( self._host, self._project, self._branch, path) - return [d['account']['email'] for d in data] + return [d['account']['email'] for d in data['code_owners']] diff --git a/tests/owners_client_test.py b/tests/owners_client_test.py index 9aaa8493f..4f727b3a7 100644 --- a/tests/owners_client_test.py +++ b/tests/owners_client_test.py @@ -27,23 +27,25 @@ emily = 'emily@example.com' def _get_owners(): - return [ - { - "account": { - "email": 'approver@example.com' - } - }, - { - "account": { - "email": 'reviewer@example.com' + return { + "code_owners": [ + { + "account": { + "email": 'approver@example.com' + } }, - }, - { - "account": { - "email": 'missing@example.com' + { + "account": { + "email": 'reviewer@example.com' + }, }, - } - ] + { + "account": { + "email": 'missing@example.com' + }, + } + ] + }