ci enhance DatasynchroTest

This commit is contained in:
odain
2021-04-01 18:32:02 +02:00
parent 3afa783ba8
commit 5f3fda95fc

View File

@@ -82,18 +82,6 @@ class DataSynchroTest extends ItopDataTestCase
/**
* Run a series of data synchronization through the REST API
*
* @dataProvider SynchroScenariosProvider
*
* @param $sDescription
* @param $sTargetClass
* @param $aSourceProperties
* @param $aSourceData
* @param $aTargetData
* @param $aAttributes
*
* @param bool $bSynchroByHttp
*
* @throws \ArchivedObjectException
* @throws \CoreCannotSaveObjectException
* @throws \CoreException
@@ -102,9 +90,16 @@ class DataSynchroTest extends ItopDataTestCase
* @throws \MySQLException
* @throws \OQLException
*/
public function testSynchroImportPage($sDescription, $sTargetClass, $aSourceProperties, $aSourceData, $aTargetData, $aAttributes, $bSynchroByHttp)
public function RunDataSynchroTest($aUserLoginUsecase)
{
var_dump($bSynchroByHttp);
$sDescription = $aUserLoginUsecase['desc'];
$sTargetClass = $aUserLoginUsecase['target_class'];
$aSourceProperties = $aUserLoginUsecase['source_properties'];
$aSourceData = $aUserLoginUsecase['source_data'];
$aTargetData = $aUserLoginUsecase['target_data'];
$aAttributes =$aUserLoginUsecase['attributes'];
$bSynchroByHttp = $aUserLoginUsecase['bSynchroByHttp'];
$sClass = $sTargetClass;
$aTargetAttributes = array_shift($aTargetData);
@@ -319,7 +314,7 @@ class DataSynchroTest extends ItopDataTestCase
$aKeys = ["creation", "update", "deletion"];
foreach ($aKeys as $sKey){
$this->assertContains("$sKey errors: 0", $sResultsViewable);
$this->assertContains("$sKey errors: 0", $sResultsViewable, $sResultsViewable);
}
//N°3805 : potential javascript returned like
@@ -343,10 +338,8 @@ class DataSynchroTest extends ItopDataTestCase
}
}
public function SynchroScenariosProvider()
{
$aTestCases = array();
$aUserLoginUsecase = array(
private function GetNominalUsecaseData(){
return array(
'desc' => 'Load user logins',
'target_class' => 'UserLocal',
'source_properties' => array(
@@ -391,13 +384,20 @@ class DataSynchroTest extends ItopDataTestCase
),
'bSynchroByHttp' => false
);
}
$aTestCases['Load user logins'] = $aUserLoginUsecase;
$aTestCases['Load user logins by http'] = $aUserLoginUsecase;
$aTestCases['Load user logins by http']['bSynchroByHttp'] = true;
public function testDataSynchroByCli(){
$this->RunDataSynchroTest($this->GetNominalUsecaseData());
}
//TODO fix below usecases with Romain. be aware they are coupled with each other.
/*$aTestCases['Simple scenario with delete option (and extkey given as org/name)'] = array(
public function testDataSynchroByHttp(){
$aUserLoginUsecase = $this->GetNominalUsecaseData();
$aUserLoginUsecase['bSynchroByHttp'] = true;
$this->RunDataSynchroTest($aUserLoginUsecase);
}
public function testWithDeleteOption(){
$aUserLoginUsecase = array(
'desc' => 'Simple scenario with delete option (and extkey given as org/name)',
'target_class' => 'ApplicationSolution',
'source_properties' => array(
@@ -462,8 +462,12 @@ class DataSynchroTest extends ItopDataTestCase
),
),
'bSynchroByHttp' => false
);*/
/*$aTestCases['Update then delete with retention (to complete with manual testing) and reconciliation on org/name'] = array(
);
$this->RunDataSynchroTest($aUserLoginUsecase);
}
/*public function testUpdateThenDeleteWithRetention(){
$aUserLoginUsecase = array(
'desc' => 'Update then delete with retention (to complete with manual testing) and reconciliation on org/name',
'target_class' => 'ApplicationSolution',
'source_properties' => array(
@@ -514,8 +518,13 @@ class DataSynchroTest extends ItopDataTestCase
),
),
'bSynchroByHttp' => false
);*/
/*$aTestCases['Simple scenario loading a few ApplicationSolution'] = array(
);
$this->RunDataSynchroTest($aUserLoginUsecase);
}*/
public function testLoadingApplicationSolution(){
$aUserLoginUsecase= array(
'desc' => 'Simple scenario loading a few ApplicationSolution',
'target_class' => 'ApplicationSolution',
'source_properties' => array(
@@ -611,7 +620,7 @@ class DataSynchroTest extends ItopDataTestCase
),
),
'bSynchroByHttp' => false
);*/
return $aTestCases;
);
$this->RunDataSynchroTest($aUserLoginUsecase);
}
}