Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pierre Goiffon
committed
Oct 21, 2021
1 parent
a353317
commit 7757f1f
Showing
3 changed files
with
110 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
class privUITransactionFileTest extends \Combodo\iTop\Test\UnitTest\ItopDataTestCase | ||
{ | ||
const USER_TEST_LOGIN = 'support_test_privUITransaction'; | ||
|
||
public function testIsTransactionValid() { | ||
$this->CreateUser(static::USER_TEST_LOGIN, 5); // profile:5 is "Support agent" | ||
|
||
// create token in the support user context | ||
UserRights::Login(self::USER_TEST_LOGIN); | ||
$sTransactionIdUserSupport = privUITransactionFile::GetNewTransactionId(); | ||
$bResult = privUITransactionFile::IsTransactionValid($sTransactionIdUserSupport, false); | ||
$this->assertTrue($bResult, 'Token created by support user must be valid in the support user context'); | ||
|
||
// test token in the admin user context | ||
UserRights::Login('admin'); | ||
$bResult = privUITransactionFile::IsTransactionValid($sTransactionIdUserSupport, false); | ||
$this->assertFalse($bResult, 'Token created by support user must be invalid in the admin user context'); | ||
$bResult = privUITransactionFile::RemoveTransaction($sTransactionIdUserSupport); | ||
$this->assertFalse($bResult, 'Token created by support user cannot be removed in the admin user context'); | ||
|
||
// test other methods in the support user context | ||
UserRights::Login(self::USER_TEST_LOGIN); | ||
$bResult = privUITransactionFile::RemoveTransaction($sTransactionIdUserSupport); | ||
$this->assertTrue($bResult, 'Token created by support user must be removed in the support user context'); | ||
} | ||
} |