[rt-users] RE: critical bug with german letter' (Intern)

ronny.pettersen at telenor.com ronny.pettersen at telenor.com
Thu Nov 20 10:17:08 EST 2003


I've written a test using WWW::Mechanize that generates the same 
ticket with the wrong encoding. (Ticket subject is fine - correct encoding, content is not).
I used the lib/t/03web.pl to write something that just creates this ticket,
haven't done anything to check if it went fine or not.
Maybe a start for a more proper testscript...


Regards,
Ronny Pettersen
--
#!/usr/bin/perl
use strict;
use WWW::Mechanize;
use HTTP::Request::Common;
use HTTP::Cookies;
use LWP;
use Test::More qw(no_plan);

use lib "/usr/local/rt3/lib";
use RT;
ok(RT::LoadConfig);

my $cookie_jar = HTTP::Cookies->new;
my $agent = WWW::Mechanize->new();

# give the agent a place to stash the cookies
$agent->cookie_jar($cookie_jar);

# get the top page
my $url = "http://localhost".$RT::WebPath."/";
$agent->get($url);

is ($agent->{'status'}, 200, "Loaded a page");

# follow the link marked "Login"
ok($agent->{form}->find_input('user'));
ok($agent->{form}->find_input('pass'));
ok ($agent->{'content'} =~ /username:/i);
$agent->field( 'user' => 'root' );
$agent->field( 'pass' => 'password' );
# the field isn't named, so we have to click link 0
$agent->click(0);
is($agent->{'status'}, 200, "Fetched the page ok");

$agent->get($url."Ticket/Create.html?Queue=1");
is ($agent->{'status'}, 200, "Loaded Create.html");
$agent->form(3);
$agent->field('Subject' => Encode::encode_utf8("Testing æøå"));
$agent->field('Content' => Encode::encode_utf8("Content æøå"));
ok($agent->submit(), "Created new ticket with æøå");

# }}}

1;



More information about the rt-users mailing list