import jsonimport osfrom xmlrpc.client import FaultMOCK_BUGS_PATH = "/tmp/anaconda-bugzilla-mock-bugs.json"class Bug:def __init__(self, bug_id, summary, status):self.id = bug_idself.summary = summaryself.status = statusclass Bugzilla:def __init__(self, url, api_key=None):self.url = urlself.api_key = api_key@propertydef logged_in(self):if not self.api_key or self.api_key == "invalid-api-key":raise Fault(300, "The API key you specified is invalid")return Truedef build_query(self, **kwargs):return kwargsdef query(self, query):if not os.path.exists(MOCK_BUGS_PATH):return []with open(MOCK_BUGS_PATH, encoding="utf-8") as handle:data = json.load(handle)return [Bug(item["id"], item["summary"], item["status"]) for item in data]def createbug(self, **kwargs):class NewBug:id = 999999return NewBug()def attachfile(self, *args, **kwargs):return 1