9 # The test functions are placed here to make things easier
11 use DebbugsTest qw(:all);
15 create_debbugs_configuration();
17 my $sendmail_dir = $config{sendmail_dir};
18 my $spool_dir = $config{spool_dir};
20 # We're going to use create mime message to create these messages, and
21 # then just send them to receive.
23 send_message(to=>'submit@bugs.something',
24 headers => [To => 'submit@bugs.something',
25 From => 'foo@bugs.something',
26 Subject => 'Submiting a bug',
34 attachments => [<<EOF]) or fail('Unable to send message');
35 This is a silly attachment to make sure that pseudoheaders work
37 # now we check to see that we have a bug, and nextnumber has been incremented
38 ok(-e "$spool_dir/db-h/01/1.log",'log file created');
39 ok(-e "$spool_dir/db-h/01/1.summary",'sumary file created');
40 ok(-e "$spool_dir/db-h/01/1.status",'status file created');
41 ok(-e "$spool_dir/db-h/01/1.report",'report file created');
43 # next, we check to see that (at least) the proper messages have been
44 # sent out. 1) ack to submitter 2) mail to maintainer
46 # This keeps track of the previous size of the sendmail directory
49 num_messages_sent($SD_SIZE,2,
51 'submit messages appear to have been sent out properly',
54 send_message(to=>'1-done@bugs.something',
55 headers => [To => '1-done@bugs.something',
56 From => 'foo@bugs.something',
57 Subject => 'Closing a bug with pseudoheaders',
64 I've closed this silly bug; using an UTF-8 non-breaking space to test that
65 https://bugs.debian.org/817128 was fixed too.
67 attachments => [<<EOF,
68 This is one silly attachment to make sure that pseudoheaders work
70 <<EOF]) or fail('Unable to send message');
71 And this is another, just in case.
74 # now we need to check to make sure that the control message actually did anything
75 # This is an eval because $ENV{DEBBUGS_CONFIG_FILE} isn't set at BEGIN{} time
76 eval "use Debbugs::Status qw(read_bug writebug);";
77 my $status = read_bug(bug=>1);
78 is($status->{done},'foo@bugs.something','bug 1 was closed properly');
79 is_deeply($status->{fixed_versions},["1"],'bug 1 was fixed in the proper version');