def test_video(c): name = 'testing.mp4' ar = 1 controls = 2 mute = 2 enable = 1 slides_settings = Slides_c.get() slides_settings.status = False video_settings = Vid.get() video_settings.enabled = True video = Media(True, name=name) db.session.add(video) db.session.commit() video_id = video.id response = c.post('/video', data={ 'video': video_id, 'ar': ar, 'enable': enable, 'mute': mute, 'controls': controls }, follow_redirects=True) assert response.status == '200 OK' assert Vid.get().enable == enable assert Vid.get().vname == name assert Vid.get().mute == mute assert Vid.get().ar == ar assert Vid.get().controls == controls assert Vid.get().vkey == video_id assert Media.get(video_id).used is True
def __init__(self, *args, **kwargs): super(TouchScreenForm, self).__init__(*args, **kwargs) for m in Media.get_all_images(): self.background.choices += [(m.id, f'{m.id}. {m.name}')] for m in Media.get_all_audios(): self.naudio.choices += [(m.id, f'{m.id}. {m.name}')]
def test_delete_multimedia(c): media = Media(True, False, False, False, 'testing.mp3') db.session.add(media) db.session.commit() media_id = media.id response = c.get(f'/multi_del/{media_id}', follow_redirects=True) assert media_id != 0 assert response.status == '200 OK' assert Media.get(media_id) is None
def __init__(self, *args, **kwargs): super(DisplayScreenForm, self).__init__(*args, **kwargs) for m in Media.get_all_images(): self.background.choices += [(m.id, f'{m.id}. {m.name}')] for m in Media.get_all_audios(): self.naudio.choices += [(m.id, f'{m.id}. {m.name}')] for shortcode, bundle in get_tts_safely().items(): self[f'check{shortcode}'].label = self.translate( bundle.get('language'))
def test_add_slide_image(c): slides_settings = Slides_c.get() slides_settings.status = True video_settings = Vid.get() video_settings.enabled = False background = Media(img=True, name='testing.jpg') db.session.add(background) db.session.commit() background_id = background.id properties = { 'title': 'testing_title', 'hsize': '150%', 'hcolor': 'testing_hcolor', 'hfont': 'testing_hfont', 'hbg': 'testing_hbg', 'subti': 'teesting_subti', 'tsize': '150%', 'tcolor': 'testing_tcolor', 'tfont': 'testing_tfont', 'tbg': 'testing_tbg' } data = {'background': background_id, **properties} response = c.post('/slide_a', data=data, follow_redirects=True) assert response.status == '200 OK' assert background_id != 0 for key, value in properties.items(): slide = Slides.query.filter_by(**{key: value}).first() assert slide is not None assert slide.ikey == background_id
def __init__(self, defLang='en', *args, **kwargs): super(VideoForm, self).__init__(*args, **kwargs) videos = Media.get_all_videos() for v in videos: self.video.choices.append((v.id, f'{v.id}. {v.name}')) if not videos: self.video.choices = [(0, self.translate('No videos were found'))]
def __init__(self, *args, **kwargs): super(SlideAddForm, self).__init__(*args, **kwargs) for m in Media.get_all_images(): self.background.choices += [(m.id, f'{m.id}. {m.name}')]