コード例 #1
0
 def test_getPlaylistFileNotFoundMock(self):
     inputType = InputDataFile()
     directoryPath = "missing file"
     logger = IOTest()
     InputDataFile.getRawData = MagicMock(side_effect=FileNotFoundError)
     playlist = getPlaylist(inputType, directoryPath, logger)
     self.assertEqual("stub_bensound-dubstep.wav", playlist[0])
コード例 #2
0
    def test_inputDataFile(self):
        inputType = InputDataFile()
        logger = IOTest()
        directoryPath = "../../Music/"

        playlist = getPlaylist(inputType, directoryPath, logger)
        self.assertEqual("Beat Of Success.mp3", playlist[0])
コード例 #3
0
 def test_getPlaylistFileNotFoundMockOutput(self):
     inputType = InputDataFile()
     directoryPath = "missing file"
     logger = IOTest()
     InputDataFile.getRawData = MagicMock(side_effect=FileNotFoundError)
     playlist = getPlaylist(inputType, directoryPath, logger)
     self.assertEqual("Error. Directory was not found. Switching to stub.",
                      logger.getOutputList()[-1])
コード例 #4
0
 def test_InputDataStub(self):
     inputType = InputDataStub()
     logger = IOTest()
     playlist = getPlaylist(inputType, "stubMusic", logger)
     self.assertEqual("stub_bensound-dubstep.wav", playlist[0])
コード例 #5
0
 def test_InputDataFile(self):
     inputType = InputDataFile()
     logger = IOTest()
     playlist = getPlaylist(inputType, "../Music", logger)
     self.assertEqual("Beat Of Success.mp3", playlist[0])