示例#1
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)
示例#2
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)
示例#3
0
    def test_disable_setters_when_downloading(self):
        model = Model()

        model.setFilePath("A")
        model.setOutputPath("A")
        model.setOutputFormat(Format.FLV)
        model.setOutputTitleFormat(titleFormat.USE_BOOKMARK_TITLE)
        model.setOutputQuality(Quality.NORMAL)

        model.setStatus(State.DOWNLOADING)

        model.setFilePath("B")
        model.setOutputPath("B")
        model.setOutputFormat(Format.WAV)
        model.setOutputTitleFormat(titleFormat.USE_YOUTUBE_TITLE)
        model.setOutputQuality(Quality.HIGH)

        self.assertEqual(model.getFilePath(), "A")
        self.assertEqual(model.getOutputPath(), "A")
        self.assertEqual(model.getOutputFormat(), Format.FLV)
        self.assertEqual(model.getOutputTitleFormat(), titleFormat.USE_BOOKMARK_TITLE)
        self.assertEqual(model.getOutputQuality(), Quality.NORMAL)
示例#4
0
 def test_updating_try_downloading(self):
     model = Model()
     model.setStatus(State.UPDATING)
     model.startDownloading()
     self.assertEqual(model.getStatus(), State.UPDATING)