Changeset View
Changeset View
Standalone View
Standalone View
contrib/buildbot/test/mocks/phabricator.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# | # | ||||
# Copyright (c) 2019-2020 The Bitcoin ABC developers | # Copyright (c) 2019-2020 The Bitcoin ABC developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
import mock | import mock | ||||
from phabricator_wrapper import PhabWrapper | from phabricator_wrapper import PhabWrapper | ||||
class Result: | class Result: | ||||
def __init__(self, data: list): | def __init__(self, data: list): | ||||
self.data = data | self.data = data | ||||
def __getitem__(self, key): | |||||
return self.response[key] | |||||
__getattr__ = __getitem__ | |||||
def __setitem__(self, key, value): | |||||
self.response[key] = value | |||||
def instance(): | def instance(): | ||||
phab = None | phab = None | ||||
phab = PhabWrapper(host="https://phabricator.test") | phab = PhabWrapper(host="https://phabricator.test") | ||||
phab.logger = mock.Mock() | phab.logger = mock.Mock() | ||||
phab.dashboard = mock.Mock() | phab.dashboard = mock.Mock() | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |