From 92ff01754ab7cfe083bdff0cdafcd325b91608ea Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Mon, 19 Feb 2007 00:08:14 -0800 Subject: [PATCH] * Test pkgreport as well * Fix a few spelling mistakes in bugreport.t * Check the title of bugreport.cgi as well --- t/07_bugreport.t | 19 +++++++---- t/08_pkgreport.t | 85 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 7 deletions(-) create mode 100644 t/08_pkgreport.t diff --git a/t/07_bugreport.t b/t/07_bugreport.t index ea33725..dedd445 100644 --- a/t/07_bugreport.t +++ b/t/07_bugreport.t @@ -1,7 +1,7 @@ # -*- mode: cperl;-*- -# $Id: 05_mail.t,v 1.1 2005/08/17 21:46:17 don Exp $ -use Test::More tests => 2; + +use Test::More tests => 3; use warnings; use strict; @@ -22,7 +22,6 @@ use Test::WWW::Mechanize; # The test functions are placed here to make things easier use lib qw(t/lib); use DebbugsTest qw(:all); -use Data::Dumper; my %config; eval { @@ -45,7 +44,7 @@ END{ send_message(to=>'submit@bugs.something', headers => [To => 'submit@bugs.something', From => 'foo@bugs.something', - Subject => 'Submiting a bug', + Subject => 'Submitting a bug', ], body => <new(); -$mech->get_ok('http://localhost:'.$port.'/?bug=1'); +$mech->get_ok('http://localhost:'.$port.'/?bug=1', + 'Page received ok'); +ok($mech->content() =~ qr/\\#1\s+\-\s+Submitting a bug/i, + 'Title of bug is submitting a bug'); + +# Other tests for bugs in the page should be added here eventually diff --git a/t/08_pkgreport.t b/t/08_pkgreport.t new file mode 100644 index 0000000..f834c75 --- /dev/null +++ b/t/08_pkgreport.t @@ -0,0 +1,85 @@ +# -*- mode: cperl;-*- + + +use Test::More tests => 3; + +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); +use Debbugs::MIME qw(create_mime_message); +use File::Basename qw(dirname basename); +use Test::WWW::Mechanize; +# The test functions are placed here to make things easier +use lib qw(t/lib); +use DebbugsTest qw(:all); + +my %config; +eval { + %config = create_debbugs_configuration(debug => exists $ENV{DEBUG}?$ENV{DEBUG}:0); +}; +if ($@) { + BAIL_OUT($@); +} + +# Output some debugging information if there's an error +END{ + if ($ENV{DEBUG}) { + foreach my $key (keys %config) { + diag("$key: $config{$key}\n"); + } + } +} + +# create a bug +send_message(to=>'submit@bugs.something', + headers => [To => 'submit@bugs.something', + From => 'foo@bugs.something', + Subject => 'Submitting a bug', + ], + body => <new(autocheck => 1); + +$mech->get_ok('http://localhost:'.$port.'/?pkg=foo'); + +# I'd like to use $mech->title_ok(), but I'm not sure why it doesn't +# work. +ok($mech->content()=~ qr/package foo/i, + 'Package title seems ok', + ); + +# Test more stuff here -- 2.39.2