示例#1
0
def test_process_resp():
    with open('{}/deploy.json'.format(here)) as fp:
        resp = json.load(fp)

    logs = resp['status']['logs']
    last_time = min(log['time'] for log in logs) - 7

    logger = MockLogger()
    with patch(deploy, logger=logger):
        for i in range(len(logs) + 1):
            resp['status']['logs'] = logs[:i]
            state, last_time = deploy.process_resp(resp, last_time, False)
            if i > 0:
                assert last_time == logs[i - 1]['time'], 'bad last_time'
            assert state == resp['status']['state'], 'bad state'

    assert len(logger.logs) == len(logs), 'bad number of logs'
示例#2
0
def requests():
    with patch(deploy, requests=mock_requests):
        yield