def METHOD_NAME(make_stubber, stub_runner, error_code, stop_on_action):
    iam = boto3.resource('iam')
    iam_stubber = make_stubber(iam.meta.client)
    role_name = 'test-role'
    role_policy = MagicMock(
        policy_name='test-role-policy',
        arn='arn:aws:iam:123456789012::policy/test-role-policy')
    user_name = 'test-user'
    user_policy = MagicMock(policy_name='test-user-policy')
    user_key_id = 'test-key-id-plus-more-characters'
    with stub_runner(error_code, stop_on_action) as runner:
        runner.add(
            iam_stubber.stub_list_attached_role_policies,
            role_name, {role_policy.policy_name: role_policy.arn})
        runner.add(iam_stubber.stub_get_policy, role_policy.arn)
        runner.add(iam_stubber.stub_detach_role_policy, role_name, role_policy.arn)
        runner.add(iam_stubber.stub_delete_policy, role_policy.arn)
        runner.add(iam_stubber.stub_delete_role, role_name)
        runner.add(
            iam_stubber.stub_list_user_policies, user_name, [user_policy.policy_name])
        runner.add(
            iam_stubber.stub_delete_user_policy, user_name, user_policy.policy_name)
        runner.add(iam_stubber.stub_list_access_keys, user_name, [user_key_id])
        runner.add(iam_stubber.stub_delete_access_key, user_name, user_key_id)
        runner.add(iam_stubber.stub_delete_user, user_name)
    if error_code is None:
        assume_role.teardown(iam.User(user_name), iam.Role(role_name))
    else:
        with pytest.raises(ClientError) as exc_info:
            assume_role.teardown(iam.User(user_name), iam.Role(role_name))
        assert exc_info.value.response['Error']['Code'] == error_code