+sub login {
+ my $agent = shift;
+
+ my $url = $RT::WebURL;
+ $agent->get($url);
+ is( $agent->{'status'}, 200,
+ "Loaded a page - $url" );
+
+ # {{{ test a login
+
+ # 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' => $user_obj->Name );
+ $agent->field( 'pass' => 'customer' );
+
+ # the field isn't named, so we have to click link 0
+ $agent->click(0);
+ is( $agent->{'status'}, 200, "Fetched the page ok" );
+ ok( $agent->{'content'} =~ /Logout/i, "Found a logout link" );
+}