'Runs through a full find job via the IAMRole watcher, as that supports batching.
However, this is mostly testing the logic through each function call -- this is
not going to do any boto work and that will instead be mocked out.
:return:'

def test_find_batch_changes(self):

    from security_monkey.scheduler import find_changes
    from security_monkey.monitors import Monitor
    from security_monkey.watchers.iam.iam_role import IAMRole
    from security_monkey.auditors.iam.iam_role import IAMRoleAuditor
    test_account = Account(name='TEST_ACCOUNT1')
    watcher = IAMRole(accounts=[test_account.name])
    technology = Technology(name='iamrole')
    db.session.add(technology)
    db.session.commit()
    watcher.batched_size = 3
    self.add_roles()
    batched_monitor = Monitor(IAMRole, test_account)
    batched_monitor.watcher = watcher
    batched_monitor.auditors = [IAMRoleAuditor(accounts=[test_account.name])]
    import security_monkey.scheduler
    security_monkey.scheduler.get_monitors = (lambda x, y, z: [batched_monitor])
    original_slurp_list = watcher.slurp_list
    original_slurp = watcher.slurp
    def mock_slurp_list():
        (items, exception_map) = original_slurp_list()
        for item in watcher.total_list:
            item['Arn'] = 'arn:aws:iam::012345678910:role/{}'.format(item['RoleName'])
        return (items, exception_map)
    def mock_slurp():
        (batched_items, exception_map) = original_slurp()
        for item in batched_items:
            item.arn = 'arn:aws:iam::012345678910:role/{}'.format(item.name)
            item.config['Arn'] = item.arn
            item.config['RoleId'] = item.name
        return (batched_items, exception_map)
    watcher.slurp_list = mock_slurp_list
    watcher.slurp = mock_slurp
    find_changes([test_account.name], test_account.name)
    assert (len(Item.query.all()) == 11)
    assert (len(ItemRevision.query.all()) == 11)
    assert (len(ItemAudit.query.all()) == 11)
    mock_iam().stop()
    mock_sts().stop()
    self.add_roles(initial=False)
    watcher.current_account = None
    find_changes([test_account.name], test_account.name)
    assert (len(Item.query.all()) == 11)
    assert (len(ItemAudit.query.all()) == 11)
    assert (len(ItemRevision.query.all()) == 13)
    ir = ItemRevision.query.join((Item, (ItemRevision.id == Item.latest_revision_id))).filter(Item.arn.in_(['arn:aws:iam::012345678910:role/roleNumber9', 'arn:aws:iam::012345678910:role/roleNumber10'])).all()
    assert (len(ir) == 2)
    assert (not ir[0].active)
    assert (not ir[1].active)
    def mock_slurp_list_with_exception():
        import security_monkey.watchers.iam.iam_role
        security_monkey.watchers.iam.iam_role.list_roles = (lambda **kwargs: (1 / 0))
        (items, exception_map) = original_slurp_list()
        assert (len(exception_map) > 0)
        return (items, exception_map)
    watcher.slurp_list = mock_slurp_list_with_exception
    watcher.current_account = None
    find_changes([test_account.name], test_account.name)
    mock_iam().stop()
    mock_sts().stop()
