mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 18:18:46 +02:00
Merge remote-tracking branch 'origin/support/2.6' into support/2.7
# Conflicts: # application/transaction.class.inc.php # test/application/privUITransactionFileTest.php
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
*/
|
||||
|
||||
use Combodo\iTop\Test\UnitTest\ItopTestCase;
|
||||
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
|
||||
|
||||
/**
|
||||
* @runTestsInSeparateProcesses
|
||||
@@ -25,7 +25,7 @@ use Combodo\iTop\Test\UnitTest\ItopTestCase;
|
||||
* @backupGlobals disabled
|
||||
* @covers utils
|
||||
*/
|
||||
class privUITransactionFileTest extends ItopTestCase
|
||||
class privUITransactionFileTest extends ItopDataTestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
@@ -132,4 +132,33 @@ class privUITransactionFileTest extends ItopTestCase
|
||||
}
|
||||
return rmdir($sDir);
|
||||
}
|
||||
|
||||
const USER_TEST_LOGIN = 'support_test_privUITransaction';
|
||||
|
||||
/**
|
||||
* @throws \SecurityException
|
||||
*/
|
||||
public function testIsTransactionValid() {
|
||||
$this->markTestSkipped('Still need some work for Jenkins (Token created by support user must be invalid in the admin user context)');
|
||||
|
||||
$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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user