From: Don Armstrong Date: Mon, 2 Apr 2018 19:08:02 +0000 (-0700) Subject: test whether blocking bugs are inserted correctly X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=0b5a83721e73e05dd6389b86716013123da29407;p=debbugs.git test whether blocking bugs are inserted correctly --- diff --git a/t/21_database.t b/t/21_database.t index ca416d4..e4e5239 100644 --- a/t/21_database.t +++ b/t/21_database.t @@ -5,13 +5,6 @@ use Test::More; use warnings; use strict; -# Here, we're going to shoot messages through a set of things that can -# happen. - -# First, we're going to send mesages to receive. -# To do so, we'll first send a message to submit, -# then send messages to the newly created bugnumber. - use IO::File; use File::Temp qw(tempdir); use Cwd qw(getcwd); @@ -28,19 +21,36 @@ our $tests_run = 0; my %config = create_debbugs_configuration(); -# create a bug -send_message(to=>'submit@bugs.something', - headers => [To => 'submit@bugs.something', - From => 'foo@bugs.something', - Subject => 'Submitting a bug', - ], - body => <'submit@bugs.something', + headers => [To => 'submit@bugs.something', + From => 'foo@bugs.something', + Subject => 'Submitting a bug '.$_, + ], + run_processall => 0, + body => < 'control@bugs.something', + headers => [To => 'control@bugs.something', + From => 'foo@bugs.something', + Subject => "Munging bugs with blocks", + ], + body => <<'EOF') or fail 'message to control@bugs.something failed'; +block 1 by 2 +block 3 by 1 +block 4 by 1 +thanks EOF + +## create the database my $pgsql = create_postgresql_database(); update_postgresql_database($pgsql); @@ -56,8 +66,19 @@ ok($s = Debbugs::DB->connect($pgsql->dsn), $tests_run++; ok($s->resultset('Bug')->search({id => 1})->single->subject eq - 'Submitting a bug', + 'Submitting a bug 1', "Correct bug title"); $tests_run++; +my @blocking_bugs = + map {$_->{blocks}} + $s->resultset('Bug')->search({id => 1})->single-> + bug_blocks_bugs(undef, + {columns => [qw(blocks)], + result_class=>'DBIx::Class::ResultClass::HashRefInflator', + })->all; +$tests_run++; +is_deeply([sort @blocking_bugs], + [3,4],"Blocking bugs of 1 inserted correctly"); + done_testing($tests_run);