NAME

TestBounceParser - utility functions for Mail::DeliveryStatus::BounceParser's unittests

SYNOPSIS

use TestBounceParser;

check_report('file-in-corpus.msg',
  is_bounce => 1,
  addresses => [qw(foo@example.com bar@example.com)],
  std_reason => 'domain_error',
  smtp_code => 550
);

EXPORTED FUNCTIONS

readfile

my $content = readfile('path/to_file.msg');

Returns the content of the file passed as argument.

check_report

my $bounce = check_report($filename, %expectations);

The following keys are supported in %expectations:

is_bounce

whether the message is expected to be a bounce

reports

the number of reports we are expecting

addresses

an Arrayref to the list of addresses we are expecting

smtp_code

the SMTP code we are expecting (e.g. "554")

status

the status code we are expecting (e.g. "5.4.4")

reason

the reason string we are expecting (e.g. "550 Host unknown")

orig_message_id

the parsed original message id we are expecting

todo_is_bounce

when set, the is_bounce check is guarded in a TODO block

todo_std_reason

when set, the std_reason check is guarded in a TODO block

AUTHOR

Philipp Gortan <gortan@cpan.org>