[Rt-commit] r3367 - in rt/branches/3.5-TESTING: . lib/t/regression

jesse at bestpractical.com jesse at bestpractical.com
Sun Jul 3 18:59:05 EDT 2005


Author: jesse
Date: Sun Jul  3 18:59:05 2005
New Revision: 3367

Modified:
   rt/branches/3.5-TESTING/   (props changed)
   rt/branches/3.5-TESTING/lib/t/regression/07acl.t
   rt/branches/3.5-TESTING/lib/t/regression/09record_cf_api.t
Log:
 r22221 at hualien:  jesse | 2005-07-03 18:24:23 -0400
  r22145 at hualien:  jesse | 2005-07-03 17:50:08 -0400
   r22097 at hualien:  jesse | 2005-07-03 16:25:18 -0400
    r21520 at hualien:  jesse | 2005-06-23 19:49:06 -0400
    * Test suite improvements and cleanups
   
  
 


Modified: rt/branches/3.5-TESTING/lib/t/regression/07acl.t
==============================================================================
--- rt/branches/3.5-TESTING/lib/t/regression/07acl.t	(original)
+++ rt/branches/3.5-TESTING/lib/t/regression/07acl.t	Sun Jul  3 18:59:05 2005
@@ -10,10 +10,9 @@
 
 # Create a user with basically no rights, to start.
 my $user_obj = RT::User->new($RT::SystemUser);
-my ($ret, $msg) = $user_obj->LoadOrCreateByEmail($$.'-customer at example.com');
-ok($ret, 'ACL test user created'. $user_obj->Name);
+my ($ret, $msg) = $user_obj->LoadOrCreateByEmail('customer-'.$$.'@example.com');
+ok($ret, 'ACL test user creation');
 $user_obj->SetName('customer-'.$$);
-ok($user_obj->Name, "The user's name is ".$user_obj->Name);
 $user_obj->SetPrivileged(1);
 ($ret, $msg) = $user_obj->SetPassword('customer');
 ok($ret, "ACL test password set. $msg");
@@ -33,6 +32,22 @@
 # get the top page
 login($agent, $user_obj);
 
+is ($agent->{'status'}, 200, "Loaded a page - $RT::WebURL");
+# {{{ 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' => 'customer-'.$$ );
+$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");
+
 # Test for absence of Configure and Preferences tabs.
 ok(!$agent->find_link( url => '/Admin/',
 		       text => 'Configuration'), "No config tab" );
@@ -113,7 +128,7 @@
 $agent->reload();
 ok($agent->form_name('BuildQuery'), "Yep, form is still there");
 my $input = $agent->current_form->find_input('ValueOfActor');
-ok(grep(/customer/, $input->value_names()), "Found self in the actor listing");
+ok(grep(/customer-$$/, $input->value_names()), "Found self in the actor listing");
 
 sub login {
     my $agent = shift;

Modified: rt/branches/3.5-TESTING/lib/t/regression/09record_cf_api.t
==============================================================================
--- rt/branches/3.5-TESTING/lib/t/regression/09record_cf_api.t	(original)
+++ rt/branches/3.5-TESTING/lib/t/regression/09record_cf_api.t	Sun Jul  3 18:59:05 2005
@@ -1,8 +1,8 @@
 #!/usr/bin/perl
 
 use strict;
-#use warnings FATAL => 'all';
-use Test::More tests => 130;
+use warnings FATAL => 'all';
+use Test::More tests => 131;
 
 use RT;
 RT::LoadConfig();
@@ -18,7 +18,8 @@
 
 
 my $queue = RT::Queue->new( $RT::SystemUser );
-$queue->Create( Name => 'RecordCustomFields' );
+$queue->Create( Name => 'RecordCustomFields-'.$$ );
+ok ($queue->id, "Created the queue");
 
 my $ticket = RT::Ticket->new( $RT::SystemUser );
 $ticket->Create(
@@ -35,19 +36,18 @@
 is( $cfvs->Count, 0 );
 is( $ticket->FirstCustomFieldValue, undef );
 
-
 my $local_cf1 = RT::CustomField->new( $RT::SystemUser );
-$local_cf1->Create( Name => 'RecordCustomFields1', Type => 'SelectSingle', Queue => $queue->id );
+$local_cf1->Create( Name => 'RecordCustomFields1-'.$$, Type => 'SelectSingle', Queue => $queue->id );
 $local_cf1->AddValue( Name => 'RecordCustomFieldValues11' );
 $local_cf1->AddValue( Name => 'RecordCustomFieldValues12' );
 
 my $local_cf2 = RT::CustomField->new( $RT::SystemUser );
-$local_cf2->Create( Name => 'RecordCustomFields2', Type => 'SelectSingle', Queue => $queue->id );
+$local_cf2->Create( Name => 'RecordCustomFields2-'.$$, Type => 'SelectSingle', Queue => $queue->id );
 $local_cf2->AddValue( Name => 'RecordCustomFieldValues21' );
 $local_cf2->AddValue( Name => 'RecordCustomFieldValues22' );
 
 my $global_cf3 = RT::CustomField->new( $RT::SystemUser );
-$global_cf3->Create( Name => 'RecordCustomFields3', Type => 'SelectSingle', Queue => 0 );
+$global_cf3->Create( Name => 'RecordCustomFields3-'.$$, Type => 'SelectSingle', Queue => 0 );
 $global_cf3->AddValue( Name => 'RecordCustomFieldValues31' );
 $global_cf3->AddValue( Name => 'RecordCustomFieldValues32' );
 
@@ -113,7 +113,6 @@
 	}
 	
 }
-
 # Add some values to our custom fields
 for (@custom_fields) {
 	# this should be tested elsewhere
@@ -130,15 +129,15 @@
 	
 	# does it exist?
 	$cfvs = $ticket->CustomFieldValues;
-	is( $cfvs->Count, 3 );
+	is( $cfvs->Count, 3, "We found all three custom fields on our ticket" );
 	for (@custom_fields) {
 		$cfvs = $ticket->CustomFieldValues( $_->id );
-		is( $cfvs->Count, 1 );
+		is( $cfvs->Count, 1 , "we found one custom field when searching by id");
 	
 		$cfvs = $ticket->CustomFieldValues( $_->Name );
-		is( $cfvs->Count, 1 );
-		is( $ticket->FirstCustomFieldValue( $_->id ), 'Foo' );
-		is( $ticket->FirstCustomFieldValue( $_->Name ), 'Foo' );
+		is( $cfvs->Count, 1 , " We found one custom field when searching by name for " . $_->Name);
+		is( $ticket->FirstCustomFieldValue( $_->id ), 'Foo' , "first value by id is foo");
+		is( $ticket->FirstCustomFieldValue( $_->Name ), 'Foo' , "first value by name is foo");
 	}
 	# because our CFs are SingleValue then new value addition should override
 	for (@custom_fields) {
@@ -179,11 +178,11 @@
 # lets test cycle via CF object reference
 $test_add_delete_cycle->( sub { return $_[0] } );
 
-SKIP: {
+#SKIP: {
 #	skip "TODO: should we add CF values to objects via CF Name?", 48;
 # names are not unique
 	# lets test cycle via CF Name
 #	$test_add_delete_cycle->( sub { return $_[0]->Name } );
-}
+#}
 
 


More information about the Rt-commit mailing list