Debian Codegraph @

t/addresses.t

raw
1 use Test::More tests => 23;
2 use strict;
3 use lib 't';
4
5 use_ok('Test::Qpsmtpd');
6
7 ok(my ($smtpd, $conn) = Test::Qpsmtpd->new_conn(), "get new connection");
8 is(($smtpd->command('EHLO localhost'))[0], 250, 'EHLO localhost');
9
10 is(($smtpd->command('MAIL FROM:<[email protected]>'))[0],
11 250, 'MAIL FROM:<[email protected]>');
12 is($smtpd->transaction->sender->address, '[email protected]',
13 'got the right sender');
14
15 is(($smtpd->command('MAIL FROM:<ask @perl.org>'))[0],
16 250, 'MAIL FROM:<ask @perl.org>');
17 is($smtpd->transaction->sender->address,
18 'ask @perl.org',
19 'got the right sender');
20
21 is(($smtpd->command('MAIL FROM:[email protected]'))[0],
22 250, 'MAIL FROM:[email protected]');
23 is($smtpd->transaction->sender->format,
24 '<[email protected]>', 'got the right sender');
25
26 is(($smtpd->command('MAIL FROM:ask@[1.2.3.4]'))[0],
27 250, 'MAIL FROM:ask@[1.2.3.4]');
28 is($smtpd->transaction->sender->format,
29 '<ask@[1.2.3.4]>', 'got the right sender');
30
31 my $command = 'MAIL FROM:<[email protected]> SIZE=1230';
32 is(($smtpd->command($command))[0], 250, $command);
33 is($smtpd->transaction->sender->format,
34 '<[email protected]>', 'got the right sender');
35
36 $command = 'MAIL FROM:<>';
37 is(($smtpd->command($command))[0], 250, $command);
38 is($smtpd->transaction->sender->format, '<>', 'got the right sender');
39
40 $command = 'MAIL FROM:<[email protected]> SIZE=1230';
41 is(($smtpd->command($command))[0], 250, $command);
42 is($smtpd->transaction->sender->format,
43 '<[email protected]>',
44 'got the right sender');
45
46 $command = 'MAIL FROM:<[email protected]> SIZE=1230 CORRECT-WITHOUT-ARG';
47 is(($smtpd->command($command))[0], 250, $command);
48
49 $command = 'MAIL FROM:';
50 is(($smtpd->command($command))[0], 250, $command);
51 is($smtpd->transaction->sender->format, '<>', 'got the right sender');
52