8 # Here, we're going to shoot messages through a set of things that can
11 # First, we're going to send mesages to receive.
12 # To do so, we'll first send a message to submit,
13 # then send messages to the newly created bugnumber.
16 use File::Temp qw(tempdir);
18 use Debbugs::MIME qw(create_mime_message);
19 use File::Basename qw(dirname basename);
20 use Test::WWW::Mechanize;
21 use HTTP::Status qw(RC_NOT_MODIFIED);
22 # The test functions are placed here to make things easier
24 use DebbugsTest qw(:all);
26 # This must happen before anything is used, otherwise Debbugs::Config will be
27 # set to wrong values.
28 my %config = create_debbugs_configuration();
31 use_ok('Debbugs::Bug');
33 use_ok('Debbugs::Collection::Bug');
38 send_message(to=>'submit@bugs.something',
39 headers => [To => 'submit@bugs.something',
40 From => 'foo@bugs.something',
41 Subject => 'Submitting a bug '.$_,
43 run_processall => ($_ == 4 ? 1 : 0),
44 body => <<EOF) or fail('Unable to send message');
47 Tags: wontfix moreinfo
49 This is a silly bug $_
54 my $bc = Debbugs::Collection::Bug->new(bugs => [1..4]);
57 ok($bug = $bc->get(1),
58 "Created a bug correctly"
62 ok(!$bug->archiveable,
63 "Newly created bugs are not archiveable"
67 is($bug->submitter,'foo@bugs.something',
72 ok($bug->tags->tag_is_set('wontfix'),
77 is($bug->tags->as_string(),
83 ### run some tests with the database creation
85 ## create the database
86 my $pgsql = create_postgresql_database();
87 update_postgresql_database($pgsql);
89 use_ok('Debbugs::DB');
92 ok($s = Debbugs::DB->connect($pgsql->dsn),
93 "Able to connect to database");
96 $bc = Debbugs::Collection::Bug->new(bugs => [1..4],
98 ok($bug = $bc->get(1),
99 "Created a bug correctly with DB"
103 done_testing($tests);