def popen_bouncer(): return PopenResult( StreamMock( json.dumps({ 'section': [{ 'message': 'a message', 'origin': 'I come from here', 'diffs': None, }, { 'message': 'a message', 'origin': 'I come from here', 'affected_code': [ { 'start': { 'file': 'filename', 'line': 1 } }, ], 'diffs': { 'filename': 'unified diff here', }, }] })), StreamMock(self.BOUNCER_INPUT), lambda *args, **kwargs: None)
def popen_bouncer(): return PopenResult( StreamMock( json.dumps({ 'too_many': [{ 'message': 'message ' + str(i), 'origin': 'I come from here' } for i in range(12)] })), StreamMock(self.BOUNCER_INPUT), lambda *args, **kwargs: None)
def fake_popen_failure(cmd, **kwargs): if 'run.py' in cmd: return PopenResult( StreamMock( '{"status": "error", "error": "Command \'[\'git\', \'rebase\'' ', \'master\']\' returned non-zero exit status 128."}'), lambda *args, **kwargs: None)
def fake_popen_success(cmd, **kwargs): if 'run.py' in cmd: return PopenResult(StreamMock('{"status": "success"}'), lambda *args, **kwargs: None)
def popen_bouncer(): return PopenResult(StreamMock('{}'), StreamMock(self.BOUNCER_INPUT), lambda *args, **kwargs: None)
def popen_coala(): return PopenResult(StreamMock('{"file_dicts": {}, "results": {}}'), StreamMock(''), lambda *args, **kwargs: None)