import of rt 3.0.9
[freeside.git] / rt / lib / t / 03web.pl
index 4500ff2..94ad3e9 100644 (file)
@@ -5,6 +5,7 @@ use WWW::Mechanize;
 use HTTP::Request::Common;
 use HTTP::Cookies;
 use LWP;
+use Encode;
 
 my $cookie_jar = HTTP::Cookies->new;
 my $agent = WWW::Mechanize->new();
@@ -15,7 +16,7 @@ $agent->cookie_jar($cookie_jar);
 
 
 # get the top page
-my $url = "http://localhost/";
+my $url = "http://localhost".$RT::WebPath."/";
 $agent->get($url);
 
 is ($agent->{'status'}, 200, "Loaded a page");
@@ -37,6 +38,37 @@ is($agent->{'status'}, 200, "Fetched the page ok");
 ok( $agent->{'content'} =~ /Logout/i, "Found a logout link");
 
 
+
+$agent->get($url."Ticket/Create.html?Queue=1");
+is ($agent->{'status'}, 200, "Loaded Create.html");
+$agent->form(3);
+# Start with a string containing characters in latin1
+my $string = "I18N Web Testing æøå";
+Encode::from_to($string, 'iso-8859-1', 'utf8');
+$agent->field('Subject' => "Foo");
+$agent->field('Content' => $string);
+ok($agent->submit(), "Created new ticket with $string");
+
+ok( $agent->{'content'} =~ qr{$string} , "Found the content");
+
+$agent->get($url."Ticket/Create.html?Queue=1");
+is ($agent->{'status'}, 200, "Loaded Create.html");
+$agent->form(3);
+# Start with a string containing characters in latin1
+my $string = "I18N Web Testing æøå";
+Encode::from_to($string, 'iso-8859-1', 'utf8');
+$agent->field('Subject' => $string);
+$agent->field('Content' => "BAR");
+ok($agent->submit(), "Created new ticket with $string");
+
+ok( $agent->{'content'} =~ qr{$string} , "Found the content");
+
+
+
+# }}}
+
+
+
 use File::Find;
 find ( \&wanted , 'html/');