7 # The test functions are placed here to make things easier
9 use DebbugsTest qw(:all);
13 create_debbugs_configuration();
15 my $debbugs_config_file = $ENV{DEBBUGS_CONFIG_FILE};
19 my $version_cgi_handler = sub {
21 $ENV{DEBBUGS_CONFIG_FILE} = $debbugs_config_file;
22 open($fh,'-|',-e './cgi/version.cgi'? './cgi/version.cgi' : '../cgi/version.cgi');
26 if (/^\s*$/ and $status) {
27 print "HTTP/1.1 $status OK\n";
33 if (/^Status:\s*(\d+)/i) {
43 ok(DebbugsTest::HTTPServer::fork_and_create_webserver($version_cgi_handler,$port),
44 'forked HTTP::Server::Simple successfully');
47 my $ua = LWP::UserAgent->new;
48 $ua->agent("DebbugsTesting/0.1 ");
51 my $req = HTTP::Request->new(GET => "http://localhost:$port/");
53 my $res = $ua->request($req);
54 ok($res->is_success(),'cgi/version.cgi returns success');
55 my $etag = $res->header('Etag');
57 $req = HTTP::Request->new(GET => "http://localhost:$port/",['If-None-Match',$etag]);
58 $res = $ua->request($req);
59 ok($res->code() eq '304','If-None-Match set gives us 304 not modified');