# Copyright (c) 2002-2007 bivio Software, Inc. 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: Request.bunit,v 1.4 2008/02/01 18:08:16 nagler Exp $ [ class() => [ initialize_fully => sub { my($case, $actual) = @_; return $actual->[0]->isa(class()) ? 1 : 0; }, set_realm_and_user => [ demo => undef, ], ], sub {req()} => [ { method => 'set_user_state_and_cookie', compute_return => sub { my($c) = model('UserLoginForm')->unsafe_get_cookie_user_id(req()); return [ req()->get('user_state')->get_name, req()->unsafe_get_nested(qw(auth_user name)), $c && model(RealmOwner => {realm_id => $c})->get('name'), ]; }, } => [ just_visitor => [qw(JUST_VISITOR), undef, undef], [logged_out => 'demo'] => [LOGGED_OUT => undef, 'demo'], [logged_in => 'demo'] => [qw(LOGGED_IN demo demo)], ], { method => 'client_redirect', compute_params => sub { my(undef, $params) = @_; req()->set_user('btest_read'); req()->set_realm(undef); req()->set_user_state_and_cookie('just_visitor'); return $params; }, compute_return => sub { return [req('task_id')->get_name]; }, } => [ USER_ACCOUNT_EDIT => FORBIDDEN(), SITE_ROOT => 'SITE_ROOT', ], put_on_query => [ [ begin_date => 'a begin date', date => 'a date', count => 'a count', interval => 'an interval', page_number => 'a page number', order_by => 'an order by', parent_id => 'a parent id', search => 'a search', this => 'a this id', foo => 'a foo', ] => sub { assert_equals({ b => 'a begin date', d => 'a date', c => 'a count', i => 'an interval', n => 'a page number', o => 'an order by', p => 'a parent id', s => 'a search', t => 'a this id', foo => 'a foo', }, req()->get('query')); return 1; }, ], ], sub { my($req) = class()->get_instance; $req->capture_mail; my($msg) = Bivio::Mail::Outgoing->new( Bivio::Mail::Incoming->new(\(<<'EOF'))); From: Joe Blow To: mary@example.com What a body! EOF $msg->set_recipients('mary@example.com'); $msg->enqueue_send; return $req; } => [ unsafe_get_captured_mail => qr{From.*What}s, ], ];