# Copyright (c) 2009 bivio Software, Inc.g All Rights Reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: TaskLogList.bunit,v 1.10 2010/02/20 22:44:09 nagler Exp $ ListModel(); req()->initialize_fully; ShellUtil_TaskLog()->test_reset; my($t) = class('Agent.Task')->get_by_id('FORUM_FILE_TREE_LIST'); req()->set_realm_and_user(qw(task_log_bunit task_log_user)); req()->put(query => { x => 'x' x 501, }); my($now) = DateTime('2/15/2009 12:0:0'); DateTime()->set_test_now($now); model('TaskLog')->handle_pre_execute_task($t, req()); model('TaskLog')->handle_post_execute_task($t, req()); DateTime()->set_test_now(my $later = DateTime()->add_days($now, 30)); req()->set_realm_and_user(qw(task_log_bunit root)); model('TaskLog')->handle_pre_execute_task($t, req()); model('TaskLog')->handle_post_execute_task($t, req()); req()->initialize_fully('GROUP_TASK_LOG'); req()->set_realm('task_log_bunit'); options({ compute_params => sub { my(undef, $params) = @_; model(FilterQueryForm => {@$params}); return []; }, check_return => sub { my($case, undef, $expect) = @_; @$expect = qw(root task_log_user) if ($expect->[0] || '') eq 'all'; assert_contains([map(+{ 'TaskLog.uri' => '/?x=' . ('x' x 496), 'TaskLog.user_id' => realm_id($_), 'TaskLog.realm_id' => realm_id('task_log_bunit'), 'TaskLog.super_user_id' => undef, 'Email.email' => email($_), 'TaskLog.client_address' => '127.0.0.1', }, @$expect)], $case->get('object')->map_rows); return 1; }, }); [ unauth_load_all => [ [] => 'root', [b_filter => '_'] => 'all', ], load_all => [ [] => 'root', [b_filter => '_'] => 'all', [b_filter => 'task_log_user@'] => 'task_log_user', [b_filter => '-task_log_user@'] => 'root', [b_filter => '=' . Date()->to_string($now)] => 'task_log_user', [b_filter => '>' . Date()->to_string(Date()->add_days($now, 1))] => 'root', [b_filter => '=' . Date()->to_string(Date()->add_days($now, 1))] => [], [b_filter => '=' . substr(Date()->to_xml($now), 0, 7)] => 'task_log_user', ], ];