Refactor ReadHttpResponse to be error-friendlier
Gerrit sometimes returns a full response json object at
the same time as returning a non-200 status code. This
refactor makes it easier for calling code to request
access to that object and handle error cases on its own.
Bug: 710028
Change-Id: Id1017d580d2fb843d5ca6287efcfed8775c52cd6
Reviewed-on: https://chromium-review.googlesource.com/479450
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index eeb977a..00640be 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -2184,7 +2184,7 @@
def test_patch_gerrit_not_exists(self):
def notExists(_issue, *_, **kwargs):
- self.assertFalse(kwargs['ignore_404'])
+ self.assertNotIn(404, kwargs['accept_statuses'])
raise git_cl.gerrit_util.GerritError(404, '')
self.mock(git_cl.gerrit_util, 'GetChangeDetail', notExists)