]> git.donarmstrong.com Git - debbugs.git/blob - t/19_summary_current_message.t
Fix (and test) setting summary/outlook in Control: messages (Closes: #836613).
[debbugs.git] / t / 19_summary_current_message.t
1 # -*- mode: cperl;-*-
2
3 use Test::More;
4
5 use warnings;
6 use strict;
7
8 # The test functions are placed here to make things easier
9 use lib qw(t/lib);
10 use DebbugsTest qw(:all);
11 use Data::Dumper;
12
13 my %config =
14     create_debbugs_configuration();
15
16 my $sendmail_dir = $config{sendmail_dir};
17 my $spool_dir = $config{spool_dir};
18
19 # We're going to use create mime message to create these messages, and
20 # then just send them to receive.
21
22 send_message(to=>'submit@bugs.something',
23              headers => [To   => 'submit@bugs.something',
24                          From => 'foo@bugs.something',
25                          Subject => 'Submiting a bug',
26                         ],
27              body => <<EOF) or fail('Unable to send message');
28 Package: foo
29 Severity: normal
30
31 This is a silly bug
32 EOF
33
34 # now we check to see that we have a bug, and nextnumber has been incremented
35 ok(-e "$spool_dir/db-h/01/1.log",'log file created');
36 ok(-e "$spool_dir/db-h/01/1.summary",'sumary file created');
37 ok(-e "$spool_dir/db-h/01/1.status",'status file created');
38 ok(-e "$spool_dir/db-h/01/1.report",'report file created');
39
40 # next, we check to see that (at least) the proper messages have been
41 # sent out. 1) ack to submitter 2) mail to maintainer
42
43 # This keeps track of the previous size of the sendmail directory
44 my $SD_SIZE = 0;
45 $SD_SIZE =
46     num_messages_sent($SD_SIZE,2,
47                       $sendmail_dir,
48                       'submit messages appear to have been sent out properly',
49                      );
50
51
52 # set the summary to "This is the summary of the silly bug"
53
54 send_message(to => 'control@bugs.something',
55              headers => [To   => 'control@bugs.something',
56                          From => 'foo@bugs.something',
57                          Subject => 'Munging a bug',
58                         ],
59              body => <<EOF) or fail('sending message to 1@bugs.someting failed');
60 summary 1 0
61 thanks
62
63 This is the summary of the silly bug
64
65 This is not the summary of the silly bug
66 EOF
67
68 # now we need to check to make sure that the control message actually did anything
69 # This is an eval because $ENV{DEBBUGS_CONFIG_FILE} isn't set at BEGIN{} time
70 eval "use Debbugs::Status qw(read_bug writebug);";
71 my $status = read_bug(bug=>1);
72 is($status->{summary},"This is the summary of the silly bug",'bug 1 has right summary');
73
74 send_message(to => '1@bugs.something',
75              headers => [To   => '1@bugs.something',
76                          From => 'foo@bugs.something',
77                          Subject => 'Munging a bug',
78                         ],
79              body => <<EOF) or fail('sending message to 1@bugs.someting failed');
80 Control: summary -1 0
81
82 This is a new summary.
83
84 This is not the summary of the silly bug
85 EOF
86
87 $status = read_bug(bug=>1);
88 is($status->{summary},"This is a new summary.",'Control: summary setting works');
89
90
91 done_testing();