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])
def test_inputDataFile(self): inputType = InputDataFile() logger = IOTest() directoryPath = "../../Music/" playlist = getPlaylist(inputType, directoryPath, logger) self.assertEqual("Beat Of Success.mp3", playlist[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])
def test_InputDataStub(self): inputType = InputDataStub() logger = IOTest() playlist = getPlaylist(inputType, "stubMusic", logger) self.assertEqual("stub_bensound-dubstep.wav", playlist[0])
def test_InputDataFile(self): inputType = InputDataFile() logger = IOTest() playlist = getPlaylist(inputType, "../Music", logger) self.assertEqual("Beat Of Success.mp3", playlist[0])