diff --git a/contrib/buildbot/test/mocks/phabricator.py b/contrib/buildbot/test/mocks/phabricator.py --- a/contrib/buildbot/test/mocks/phabricator.py +++ b/contrib/buildbot/test/mocks/phabricator.py @@ -13,6 +13,14 @@ def __init__(self, data: list): self.data = data + def __getitem__(self, key): + return self.response[key] + + __getattr__ = __getitem__ + + def __setitem__(self, key, value): + self.response[key] = value + def instance(): phab = None diff --git a/contrib/buildbot/test/test_phabricator.py b/contrib/buildbot/test/test_phabricator.py --- a/contrib/buildbot/test/test_phabricator.py +++ b/contrib/buildbot/test/test_phabricator.py @@ -9,7 +9,6 @@ import os import unittest -from phabricator import Result from phabricator_wrapper import BITCOIN_ABC_PROJECT_PHID, BITCOIN_ABC_REPO import test.mocks.phabricator @@ -345,8 +344,9 @@ # Check the file content can be retrieved expected_content = b'Some nice content' - self.phab.file.download.return_value = Result( - b64encode(expected_content)) + result = test.mocks.phabricator.Result([]) + result.response = b64encode(expected_content) + self.phab.file.download.return_value = result configure_file_content_query() file_content = self.phab.get_file_content_from_master(path) assert_file_commit_and_file_searched()