Ejemplo n.º 1
0
 def test_loading_book_mark_good(self):
     model = Model()
     
     self.assertEqual(model.getStatus(), State.NO_OPEN_FILE)        
     model.loadBookmark(os.getcwd() + "\\bookmarks.html")
     self.assertEqual(model.getStatus(), State.FILE_OPENED)
     self.assertEqual(model.numberOfVideos(), 3)
Ejemplo n.º 2
0
 def test_loading_book_mark_bad(self):
     model = Model()
     
     #test to make sure that if the file does not exist, the state
     #is still NO_OPEN_FILE. We don't check if its EMPTY_FILE since
     #that is just a flag state for the UI to display a error dialog box
     #and instantly changes back to NO_OPEN_FILE after the UI has been informed.
     self.assertEqual(model.getStatus(), State.NO_OPEN_FILE)
     model.loadBookmark("")
     self.assertEqual(model.getStatus(), State.NO_OPEN_FILE)
     self.assertEqual(model.numberOfVideos(), 0)
Ejemplo n.º 3
0
    def test_correct_bounding_setters(self):
        model = Model()

        original_OutputFormat = model.getOutputFormat()
        original_OutputTitleFormat = model.getOutputTitleFormat()
        original_getOutputQuality = model.getOutputQuality()
        original_Status = model.getStatus()

        #try to set value to one that is not defined as a constant
        model.setOutputFormat(-1)
        model.setOutputTitleFormat(-1)
        model.setOutputQuality(-1)
        model.setStatus(-1)

        self.assertEqual(model.getOutputFormat(), original_OutputFormat)
        self.assertEqual(model.getOutputTitleFormat(), original_OutputTitleFormat)
        self.assertEqual(model.getOutputQuality(), original_getOutputQuality)
        self.assertEqual(model.getStatus(), original_Status)
Ejemplo n.º 4
0
    def test_gets_and_sets(self):
        model = Model()
        
        model.setFilePath("C:\bookmark.html")
        model.setOutputPath("C:\downloads")
        model.setOutputFormat(Format.WAV)
        model.setOutputTitleFormat(titleFormat.USE_YOUTUBE_TITLE)
        model.setOutputQuality(Quality.HIGH)
        model.setStatus(State.OPENING_FILE)

        self.assertEqual(model.getFilePath(), "C:\bookmark.html")
        self.assertEqual(model.getOutputPath(), "C:\downloads")
        self.assertEqual(model.getOutputFormat(), Format.WAV)
        self.assertEqual(model.getOutputTitleFormat(), titleFormat.USE_YOUTUBE_TITLE)
        self.assertEqual(model.getOutputQuality(), Quality.HIGH)
        self.assertEqual(model.getStatus(), State.OPENING_FILE)
Ejemplo n.º 5
0
 def test_updating_try_downloading(self):
     model = Model()
     model.setStatus(State.UPDATING)
     model.startDownloading()
     self.assertEqual(model.getStatus(), State.UPDATING)