[otrs-cvs] ITSMCore/scripts/test CustomerUserService.t,1.6,1.7
"CVS commits notifications of OTRS.org" <[email protected]> Tue, 18 Jun 2013 14:29:33 +0000
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/ITSMCore/scripts/test
In directory lancelot:/tmp/cvs-serv22648/scripts/test
Modified Files:
CustomerUserService.t
Log Message:
Updated file to latest framework version.
Author: ub
Index: CustomerUserService.t
===================================================================
RCS file: /home/cvs/ITSMCore/scripts/test/CustomerUserService.t,v
retrieving revision 1.6
retrieving revision 1.7
diff -2 -u -d -r1.6 -r1.7
--- CustomerUserService.t 21 Nov 2012 20:35:48 -0000 1.6
+++ CustomerUserService.t 18 Jun 2013 14:29:28 -0000 1.7
@@ -1,5 +1,5 @@
# --
# CustomerUserService.t - CustomerUserService tests
-# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
# --
# $Id$
@@ -15,6 +15,26 @@
use vars (qw($Self));
+use Kernel::System::CustomerUser;
use Kernel::System::Service;
+use Kernel::System::UnitTest::Helper;
+# create local objects
+my $ConfigObject = Kernel::Config->new();
+
+# don't check email address validity
+$ConfigObject->Set(
+ Key => 'CheckEmailAddresses',
+ Value => 0,
+);
+
+my $CustomerUserObject = Kernel::System::CustomerUser->new(
+ %{$Self},
+ ConfigObject => $ConfigObject,
+);
+my $HelperObject = Kernel::System::UnitTest::Helper->new(
+ UnitTestObject => $Self,
+ %{$Self},
+ RestoreSystemConfiguration => 0,
+);
my $ServiceObject = Kernel::System::Service->new( %{$Self} );
@@ -76,6 +96,8 @@
);
-my $CustomerUser1 = 'SomeUser' . int( rand(1000000) );
-my $CustomerUser2 = 'SomeUser' . int( rand(1000000) );
+my $CustomerUser1 = $HelperObject->TestCustomerUserCreate()
+ || die "Did not get test customer user";
+my $CustomerUser2 = $HelperObject->TestCustomerUserCreate()
+ || die "Did not get test customer user";
# allocation test 1
@@ -284,7 +306,6 @@
);
-my $Allocation13Count = @Allocation13;
-my $Allocation13Ok = 0;
-if ( $Allocation13Count eq 1 && $Allocation13[0] eq $ServiceID2 ) {
+my $Allocation13Ok = 0;
+if ( scalar @Allocation13 eq 1 && $Allocation13[0] eq $ServiceID2 ) {
$Allocation13Ok = 1;
}
@@ -359,4 +380,55 @@
);
+# rename customer user1
+my %Customer = $CustomerUserObject->CustomerUserDataGet(
+ User => $CustomerUser1,
+);
+my $NewCustomerUser1 = $HelperObject->GetRandomID();
+my $Update = $CustomerUserObject->CustomerUserUpdate(
+ %Customer,
+ ID => $Customer{UserLogin},
+ UserLogin => $NewCustomerUser1,
+ UserID => 1,
+);
+$Self->True(
+ $Update,
+ "CustomerUserUpdate - $Customer{UserLogin} - $NewCustomerUser1",
+);
+
+# allocation test after rename
+# instantiate new service object because of caching!
+my $NewServiceObject = Kernel::System::Service->new( %{$Self} );
+
+my @Allocation17 = $NewServiceObject->CustomerUserServiceMemberList(
+ CustomerUserLogin => $Customer{UserLogin},
+ Result => 'ID',
+ DefaultServices => 0,
+);
+
+$Self->Is(
+ scalar @Allocation17,
+ 0,
+ "No services allocated to old customer $CustomerUser1 after rename",
+);
+my @Allocation18 = $ServiceObject->CustomerUserServiceMemberList(
+ CustomerUserLogin => $NewCustomerUser1,
+ Result => 'ID',
+ DefaultServices => 0,
+);
+
+$Self->Is(
+ scalar @Allocation18,
+ 1,
+ "Services allocated to new customer $NewCustomerUser1 after rename",
+);
+
+# rename customer user again so record can be deleted when test finishes
+$Update = $CustomerUserObject->CustomerUserUpdate(
+ %Customer,
+ ID => $NewCustomerUser1,
+ UserLogin => $Customer{UserLogin},
+ UserID => 1,
+);
+
# delete all test allocations to clean system
$ServiceObject->CustomerUserServiceMemberAdd(
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log