[radiofrance] site changed / backend rewritten using browser2

This commit is contained in:
Bezleputh 2015-06-25 13:57:25 +02:00
commit cfb603c6ad
4 changed files with 170 additions and 329 deletions

View file

@ -29,35 +29,18 @@ class RadioFranceTest(BackendTest):
def test_get_radios(self):
l = list(self.backend.iter_resources(objs=[Radio], split_path=[]))
self.assertTrue(0 < len(l) < 30)
for radio in l:
name = radio.split_path[-1]
if name != 'francebleu':
streams = self.backend.get_radio(name).streams
self.assertTrue(len(streams) > 0)
l = list(self.backend.iter_resources(objs=[Radio], split_path=['francebleu']))
self.assertTrue(len(l) > 30)
for radio in l:
streams = self.backend.get_radio(radio.split_path[-1]).streams
self.assertTrue(len(streams) > 0)
l = list(self.backend.iter_resources(objs=[BaseVideo], split_path=[]))
self.assertEquals(len(l), 0)
def test_get_video(self):
# this should be available up to 24/10/2014 15h00
urls = ('http://www.franceinter.fr/emission-vivre-avec-les-betes-y-arthus-bertrand-felins-g-tsai-s-envoler-conte-boreal-reha-hutin-30-m',
'http://www.franceinter.fr/player/reecouter?play=263735',
'franceinter-263735')
for url in urls:
vid = self.backend.get_video(url)
assert vid.id == urls[-1]
self.backend.fillobj(vid, ['url'])
assert vid.url.lower().endswith('.mp3')
# france culture (no expiration known)
vid = self.backend.get_video('http://www.franceculture.fr/emission-la-dispute-expositions-paul-strand-youssef-nabil-et-dorothee-smith-2012-02-01')
assert vid.id
self.backend.fillobj(vid, ['url'])
assert vid.url.lower().endswith('.mp3')
# fip (no expiration known)
# getting the proper ID is hard, hence the tests with many urls for the same content
urls = ('http://www.fipradio.fr/diffusion-club-jazzafip-du-13-mars',
'http://www.fipradio.fr/player/reecouter?play=20686',
'fip-20686')
for url in urls:
vid = self.backend.get_video(url)
assert vid.id == urls[-1]
self.backend.fillobj(vid, ['url'])
assert vid.url.lower().endswith('.mp3')