Tests for handling customize interface exception
authorsaksham1115 <saksham115@gmail.com>
Sat, 13 Aug 2016 18:03:18 +0000 (18:03 +0000)
committersaksham1115 <saksham115@gmail.com>
Sat, 13 Aug 2016 18:03:18 +0000 (18:03 +0000)
mediagoblin/tests/test_subtitles.py

index d4911a0ef8af5d08e636f64d239fd063d2d8bf9d..4e884d07da07241b9cb8904208c958e5f3c46b6e 100644 (file)
@@ -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]