# Copyright (c) 2012 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: Cookie.bunit,v 1.6 2010/09/08 21:44:22 nagler Exp $ # Copyright (c) 2002-2010 bivio Software, Inc. All rights reserved. require './Cookie.PL'; config({ 'Bivio::Delegate::Cookie' => { domain => undef, tag => 'Tt', }, }); options({ method_is_autoloaded => 1, }); [ sub {Bivio::Agent::HTTP::Cookie->new(req(), req('r'))} => [ put => [ [x1 => 'v1', x2 => 'v2'] => undef, ], header_out => [ [req(), req('r')] => 1, ], ], sub {req('r')} => [ header_out => sub { my($case, $return) = @_; my($res) = {@$return}; return 0 unless $res->{'Set-Cookie'} =~ m{^(TT=\S+); path=/; expires=}s; # Save for next test; only call is for "Cookie" req('r')->header_in(Cookie => $1); return 1; }, ], sub {'Bivio::Agent::HTTP::Cookie'} => [ new => [ [req(), req('r')] => sub { my($case, $return) = @_; return $return->[0]->get('x1') eq 'v1' ? 1 : 0; }, ], ], ];