From 6dce7184bb2ac230eaff340809c45f11dc0c5779 Mon Sep 17 00:00:00 2001 From: saksham1115 Date: Sat, 13 Aug 2016 18:03:18 +0000 Subject: [PATCH] Tests for handling customize interface exception --- mediagoblin/tests/test_subtitles.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/mediagoblin/tests/test_subtitles.py b/mediagoblin/tests/test_subtitles.py index d4911a0e..4e884d07 100644 --- a/mediagoblin/tests/test_subtitles.py +++ b/mediagoblin/tests/test_subtitles.py @@ -43,9 +43,26 @@ def test_add_subtitle_entry(test_app): def test_read_write_file(test_app): test_filepath = ['test'] - save_subtitle(test_filepath,"Testing!!!") - text = open_subtitle(test_filepath) + status = save_subtitle(test_filepath,"Testing!!!") + text = open_subtitle(test_filepath)[0] + assert status == True assert text == "Testing!!!" mg_globals.public_store.delete_file(test_filepath) + +# Checking the customize exceptions + +def test_customize_subtitle(test_app): + user_a = fixture_add_user(u"test_user") + + media = fixture_media_entry(uploader=user_a.id, save=False, expunge=False) + media.subtitle_files.append(dict( + name=u"some name", + filepath=[u"does", u"not", u"exist"], + )) + Session.add(media) + Session.flush() + + for subtitle in media.subtitle_files: + assert '' == open_subtitle(subtitle['filepath'])[0] -- 2.25.1