Skip to content

Commit 880bf6e

Browse files
committed
Bug 1547678 - Using not existent review group results in AttributeError: 'list' object has no attribute 'keys' r=zalun
Differential Revision: https://phabricator.services.mozilla.com/D29214
1 parent c1dc4fc commit 880bf6e

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

moz-phab

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,13 +2190,16 @@ def check_for_invalid_reviewers(reviewers, cwd):
21902190
for data in result["data"]
21912191
]
21922192
# We might be searching by the hashtag.
2193-
if "maps" in result and "slugMap" in result["maps"]:
2194-
found_groups.extend(
2195-
[
2196-
"#%s" % normalise_reviewer(r)
2197-
for r in result["maps"]["slugMap"].keys()
2198-
]
2199-
)
2193+
try:
2194+
if result["maps"]["slugMap"]:
2195+
found_groups.extend(
2196+
[
2197+
"#%s" % normalise_reviewer(r)
2198+
for r in result["maps"]["slugMap"].keys()
2199+
]
2200+
)
2201+
except KeyError:
2202+
pass
22002203

22012204
all_reviewers.extend(all_groups)
22022205
found_names.extend(found_groups)

tests/test_helpers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,10 @@ def test_non_existent_reviewers_or_groups_generates_error_list(arc_out):
278278
{
279279
"error": None,
280280
"errorMessage": None,
281-
"response": {"data": [{"fields": {"slug": "user-group"}}]},
281+
"response": {
282+
"data": [{"fields": {"slug": "user-group"}}],
283+
"maps": {"slugMap": []},
284+
},
282285
}
283286
),
284287
)

0 commit comments

Comments
 (0)