# Copyright (c) 2003-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: MIMEEntity.bunit,v 1.3 2007/07/10 02:14:50 nagler Exp $ Widget(); [ [[ prose('Part one', { mime_type => 'text/html; charset="us-ascii"', mime_encoding => '7bit', }), prose("From: a\@b.c\n\nPart two.", { mime_type => 'message/rfc822', mime_encoding => '7bit', }), ]] => sub { assert_equals( [ [qw(MIME-Version 1.0)], ['Content-Type' => qr{multipart/mixed;\s*boundary}is], [qw(Content-Transfer-Encoding binary)], ], shift->get('object')->mail_headers(req()), ); return qr{text/html.*\n\nPart one\n--}is; }, [[ prose('Part one', { mime_type => 'text/plain; charset="us-ascii"', mime_encoding => '7bit', }), prose('Part one', { mime_type => 'text/html', mime_charset => 'iso-8859-1', mime_encoding => '7bit', }), ], { mime_type => 'multipart/alternative', }] => sub { assert_equals( [ [qw(MIME-Version 1.0)], ['Content-Type' => qr{multipart/alternative;\s*boundary}is], [qw(Content-Transfer-Encoding binary)], ], shift->get('object')->mail_headers(req()), ); return qr{text/plain;.*us-ascii.*\nPart One\n.*text/html;.*iso-8859-1.*Part One}is; }, [[], { mime_data => prose('My Body'), mime_type => 'text/plain; charset="us-ascii"', mime_encoding => '7bit', }] => sub { assert_equals( [ [qw(MIME-Version 1.0)], ['Content-Type' => qr{^text/plain; charset="us-ascii"$}is], [qw(Content-Transfer-Encoding 7bit)], [qw(Content-Disposition inline)], ], shift->get('object')->mail_headers(req()), ); return qr{^My Body$}is; }, [[ vs_new(MIMEEntity => [ prose('ONE', { mime_type => 'text/html; charset="us-ascii"', mime_encoding => '7bit', }), prose('TWO', { mime_type => 'text/html; charset="us-ascii"', mime_encoding => 'quoted-printable', }), vs_new(MIMEEntity => { mime_data => 'THREE', mime_type => 'text/plain; charset="us-ascii"', mime_encoding => 'quoted-printable', control => 0, }), ]), ], { mime_data => prose('My Body'), mime_type => 'text/plain; charset="us-ascii"', mime_encoding => '7bit', }] => sub { assert_equals( [ [qw(MIME-Version 1.0)], ['Content-Type' => qr{multipart/mixed}is], ], shift->get('object')->mail_headers(req()), ); return qr{7bit.*My Body.*ONE.*TWO(?!.*THREE)}is; }, ];