Skip to content
Snippets Groups Projects
Commit 6cccf584 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

hotline #64396 : fix failure

parent cd617ca1
Branches
Tags
3 merge requests!2723Master,!2721Hotline,!2716hotline #64396 : add timeout on thumbnail download
Pipeline #4496 canceled with stage
in 9 minutes and 55 seconds
......@@ -29,4 +29,8 @@ class ArteVODFixtures {
return '[{"id":7002,"title":"Manon 20 ans","description":"<p>Envoyée en centre éducatif fermé après avoir poignardé sa mère, Manon a six mois pour faire ses preuves. Une minisérie à la puissance émotionnelle bouleversante, récompensée du Fipa d&#39;or, avec Alba Gaïa Bellugi et Marina Foïs.</p>","themes":[],"productionYear":null,"posterUrl":"https://vod.mediatheque-numerique.com/media/59/3a/593a5d947c887.jpeg","trailerUrl":null,"url":"https://vod.mediatheque-numerique.com/films/manon-20-ans","duration":10080,"audioLanguages":[],"directors":[],"actors":[],"publicationDate":"2017-06-09","genres":["Cinéma","Série TV"],"productionCountry":null,"codes":[],"medias":[{"type":"POSTER","url":"https://vod.mediatheque-numerique.com/media/59/3a/593a5d947c887.jpeg","modificationDate":"2017-06-09T10:34:28"}],"rate":null,"comments":[],"commentsLibrary":[],"bonus":[],"availableCountries":[{"type":"Country","code":"BE"},{"type":"Country","code":"BG"},{"type":"Country","code":"CH"},{"type":"Country","code":"CZ"},{"type":"Country","code":"CY"},{"type":"Country","code":"RO"},{"type":"Country","code":"GR"},{"type":"Country","code":"SK"},{"type":"Country","code":"SI"},{"type":"Country","code":"SE"},{"type":"Country","code":"FR"},{"type":"Country","code":"DK"},{"type":"Country","code":"HU"},{"type":"Country","code":"LT"},{"type":"Country","code":"PT"},{"type":"Country","code":"TR"},{"type":"Country","code":"LI"},{"type":"Country","code":"LV"},{"type":"Country","code":"PL"},{"type":"Country","code":"LU"},{"type":"Country","code":"EE"},{"type":"Country","code":"DE"},{"type":"Country","code":"IT"},{"type":"Country","code":"ES"},{"type":"Country","code":"HR"},{"type":"Country","code":"IS"},{"type":"Country","code":"AT"},{"type":"Country","code":"MT"},{"type":"Country","code":"IE"},{"type":"Country","code":"UK"},{"type":"Country","code":"FI"},{"type":"Country","code":"NL"},{"type":"Country","code":"NO"}],"targetAudiences":[]},{"id":7009,"title":"Squadra Criminale","description":"<p>Douze meurtres. Douze histoires de crimes...<br />\r\nCapitaine à la brigade criminelle de Turin, Valeria Ferro est une enquêtrice aussi tenace que talentueuse. Elle semble posséder un sixième sens pour reconstituer le puzzle complexe de chaque affaire tout en luttant contre les fantômes de son passé. Ceux-ci resurgissent violemment dans sa vie au moment où sa mère est libérée de prison.</p>","themes":[],"productionYear":null,"posterUrl":"https://vod.mediatheque-numerique.com/media/59/3a/593a6efba55d1.jpeg","trailerUrl":"https://media.universcine.com/cd/b5/cdb57adc-2a49-11e7-b234-bdefb096dc40.mp4","url":"https://vod.mediatheque-numerique.com/films/squadra-criminale","duration":35400,"audioLanguages":[],"directors":[],"actors":[],"publicationDate":"2017-06-09","genres":["Série TV"],"productionCountry":null,"codes":[],"medias":[{"type":"POSTER","url":"https://vod.mediatheque-numerique.com/media/59/3a/593a6efba55d1.jpeg","modificationDate":"2017-06-09T11:48:43"}],"rate":null,"comments":[],"commentsLibrary":[],"bonus":[],"availableCountries":[{"type":"Country","code":"NC"},{"type":"Country","code":"BE"},{"type":"Country","code":"PF"},{"type":"Country","code":"GP"},{"type":"Country","code":"WF"},{"type":"Country","code":"GF"},{"type":"Country","code":"CH"},{"type":"Country","code":"PM"},{"type":"Country","code":"YT"},{"type":"Country","code":"FR"},{"type":"Country","code":"MF"},{"type":"Country","code":"AD"},{"type":"Country","code":"RE"},{"type":"Country","code":"MQ"},{"type":"Country","code":"MC"}],"targetAudiences":[]}]';
}
public static function emptyPage() {
return '[]';
}
}
\ No newline at end of file
......@@ -25,82 +25,73 @@ require_once 'ArteVODFixtures.php';
abstract class ArteVODHarverstingTestCase extends ModelTestCase {
protected $_web_client;
protected $_storm_default_to_volatile = true;
public function setUp() {
public function setUp() {
parent::setUp();
$this->fixture('Class_CosmoVar', ['id' => 'types_docs',
'liste' => "1:cd\r\n200:non identifié\r\n201:livres\r\n202:bd"]);
Class_AdminVar::getLoader()
->newInstanceWithId('ARTE_VOD')
->setValeur('1');
Class_AdminVar::getLoader()
->newInstanceWithId('ARTE_VOD_LOGIN')
->setValeur('user');
Class_AdminVar::getLoader()
->newInstanceWithId('ARTE_VOD_KEY')
->setValeur('pass');
$this->_web_client = Storm_Test_ObjectWrapper::mock();
Class_AdminVar::set('ARTE_VOD', '1');
Class_AdminVar::set('ARTE_VOD_LOGIN', 'user');
Class_AdminVar::set('ARTE_VOD_KEY', 'pass');
$this->_web_client = $this->mock();
Class_WebService_BibNumerique_ArteVOD::setDefaultHttpClient($this->_web_client);
$command = $this->mock()->whenCalled('execTimedScript')->answers('');
Class_WebService_BibNumerique_RessourceNumerique::setCommand($command);
}
Class_WebService_BibNumerique_Vignette::setInstance(Storm_Test_ObjectWrapper::mock()
->whenCalled('updateAlbum')
->answers(true));
public function tearDown() {
Class_WebService_BibNumerique_ArteVOD::setDefaultHttpClient(null);
Class_WebService_BibNumerique_RessourceNumerique::setCommand(null);
parent::tearDown();
}
}
class ArteVODHarverstingFourFilmsInTwoPages extends ArteVODHarverstingTestCase {
protected $_category_wrapper;
protected $_album_wrapper;
class ArteVODHarverstingFourFilmsInTwoPages extends ArteVODHarverstingTestCase {
public function setUp() {
parent::setUp();
$auth = ['auth' => [ 'user' => 'user',
$auth = ['auth' => ['user' => 'user',
'password' => 'pass']];
$this->_web_client
->whenCalled('open_url')
->with('https://vod.mediatheque-numerique.com/api/v1/films?page_nb=1',
$auth)
->answers(ArteVODFixtures::firstPage())
->whenCalled('open_url')
->with('https://vod.mediatheque-numerique.com/api/v1/films?page_nb=2',
$auth)
->answers(ArteVODFixtures::secondPage())
->whenCalled('open_url')
->with('https://vod.mediatheque-numerique.com/api/v1/films?page_nb=3',
$auth)
->answers('[]')
->beStrict();
$this->fixture('Class_AlbumCategorie', null);
Class_Album::beVolatile();
foreach(['1' => ArteVODFixtures::firstPage(),
'2' => ArteVODFixtures::secondPage(),
'3' => Artevodfixtures::emptyPage()]
as $page => $answer) {
$this->_web_client
->whenCalled('open_url')
->with('https://vod.mediatheque-numerique.com/api/v1/films?page_nb=' . $page,
$auth)
->answers($answer);
}
// should delete nothing after harvest
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Album')
->whenCalled('deleteBy')
->answers(true);
$this->_web_client->beStrict();
$this->fixture('Class_AlbumCategorie', null);
$codif_type_doc=$this->fixture('Class_CodifTypeDoc', ['id' => Class_TypeDoc::ARTEVOD,
'famille_id' => Class_CodifTypeDoc::INCONNU,
'bibliotheques' => '1;8',
'annexes' => '10;12',
'sections' => '18;19']);
// should delete nothing after harvest
$this->onLoaderOfModel('Class_Album')
->whenCalled('deleteBy')
->answers(true);
$codif_type_doc = $this->fixture('Class_CodifTypeDoc',
['id' => Class_TypeDoc::ARTEVOD,
'famille_id' => Class_CodifTypeDoc::INCONNU,
'bibliotheques' => '1;8',
'annexes' => '10;12',
'sections' => '18;19']);
$this->fixture('Class_TypeDoc', ['id' => Class_TypeDoc::ARTEVOD,
'codif_type_doc' => $codif_type_doc,
'label'=> 'Type doc']);
$service = new Class_WebService_BibNumerique_ArteVOD();
$service->harvest();
(new Class_WebService_BibNumerique_ArteVOD())->harvest();
$this->edouard = Class_Album::findFirstBy(['order' => 'id']);
$this->squadra = Class_Album::findFirstBy(['titre'=> 'Squadra Criminale']);
......@@ -109,7 +100,7 @@ class ArteVODHarverstingFourFilmsInTwoPages extends ArteVODHarverstingTestCase {
/** @test */
public function shouldHaveCreatedFourAlbums() {
$this->assertEquals(4,count(Class_Album::findAll()));
$this->assertEquals(4, count(Class_Album::findAll()));
}
......@@ -126,9 +117,11 @@ class ArteVODHarverstingFourFilmsInTwoPages extends ArteVODHarverstingTestCase {
$this->edouard->getExternalUri());
}
/** @test */
public function descriptionShouldContainsCopaindeLycee() {
$this->assertContains('Edouard est un copain de lycée et a 45 ans',$this->edouard->getDescription());
$this->assertContains('Edouard est un copain de lycée et a 45 ans',
$this->edouard->getDescription());
}
......@@ -174,8 +167,8 @@ class ArteVODHarverstingFourFilmsInTwoPages extends ArteVODHarverstingTestCase {
/** @test */
public function vignetteShouldHaveBeenUploaded() {
$this->assertTrue(Class_WebService_BibNumerique_Vignette::getInstance()
->methodHasBeenCalled('updateAlbum'));
$this->assertTrue(Class_WebService_BibNumerique_RessourceNumerique::getCommand()
->methodHasBeenCalled('execTimedScript'));
}
......@@ -219,7 +212,7 @@ class ArteVODHarverstingFourFilmsInTwoPages extends ArteVODHarverstingTestCase {
/** @test */
public function AddingAlreadyExistingAuthorShouldNotCrashAddAuthor() {
public function addingAlreadyExistingAuthorShouldNotCrashAddAuthor() {
$this->assertNotEquals(null, $this->edouard->addAuthor('Cibien, Laurent', '005'));
}
}
\ No newline at end of file
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment