mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
✅ N°4660 Fix permissions changes in tests
This commit is contained in:
@@ -35,20 +35,16 @@ class RestTest extends ItopDataTestCase
|
||||
unlink($this->sTmpFile);
|
||||
}
|
||||
|
||||
$sConfigFile = \utils::GetConfig()->GetLoadedFile();
|
||||
@chmod($sConfigFile, 0770);
|
||||
$this->sUrl = \MetaModel::GetConfig()->Get('app_root_url');
|
||||
@chmod($sConfigFile, 0444); // Read-only
|
||||
$this->sUrl = \MetaModel::GetConfig()->Get('app_root_url');
|
||||
|
||||
$oRestProfile = \MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => 'REST Services User'), true);
|
||||
$oAdminProfile = \MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => 'Administrator'), true);
|
||||
$oRestProfile = \MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => 'REST Services User'), true);
|
||||
$oAdminProfile = \MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => 'Administrator'), true);
|
||||
|
||||
if (is_object($oRestProfile) && is_object($oAdminProfile))
|
||||
{
|
||||
$oUser = $this->CreateUser($this->sLogin, $oRestProfile->GetKey(), $this->sPassword);
|
||||
$this->AddProfileToUser($oUser, $oAdminProfile->GetKey());
|
||||
}
|
||||
}
|
||||
if (is_object($oRestProfile) && is_object($oAdminProfile)) {
|
||||
$oUser = $this->CreateUser($this->sLogin, $oRestProfile->GetKey(), $this->sPassword);
|
||||
$this->AddProfileToUser($oUser, $oAdminProfile->GetKey());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider BasicProvider
|
||||
@@ -62,6 +58,7 @@ class RestTest extends ItopDataTestCase
|
||||
$description = date('dmY H:i:s');
|
||||
$sOuputJson = $this->CreateTicketViaApi($description);
|
||||
$aJson = json_decode($sOuputJson, true);
|
||||
$this->assertNotNull($aJson, "Cannot decode returned JSON : $sOuputJson");
|
||||
$this->assertContains("0", "".$aJson['code'], $sOuputJson);
|
||||
$sUserRequestKey = $this->array_key_first($aJson['objects']);
|
||||
$this->assertContains('UserRequest::', $sUserRequestKey);
|
||||
|
||||
Reference in New Issue
Block a user