def test_file_invalid(self): self.mock_isfile.return_value = True with self.assertRaises(ValueError): mkvstrip.walk_directory("/movies/desktop.ini") self.assertTrue(self.mock_isfile.called) self.mock_isdir.assert_not_called()
def test_dir_no_mkv(self, mock_walk): self.mock_isdir.return_value = True ret = mkvstrip.walk_directory("/movies/") self.assertFalse(ret) self.assertTrue(self.mock_isfile.called) self.assertTrue(self.mock_isdir.called) self.assertTrue(mock_walk.called)
def test_dir(self, mock_walk): self.mock_isdir.return_value = True ret = mkvstrip.walk_directory("/movies/") self.assertListEqual(ret, ["/movies/movie_one.mkv", "/movies/movie_two.mkv"]) self.assertTrue(self.mock_isfile.called) self.assertTrue(self.mock_isdir.called) self.assertTrue(mock_walk.called)
def test_dir(self, mock_walk): self.mock_isdir.return_value = True ret = mkvstrip.walk_directory("/movies/") self.assertListEqual( ret, ["/movies/movie_one.mkv", "/movies/movie_two.mkv"]) self.assertTrue(self.mock_isfile.called) self.assertTrue(self.mock_isdir.called) self.assertTrue(mock_walk.called)
def test_not_found(self): with self.assertRaises(FileNotFoundError): mkvstrip.walk_directory("/movies/") self.assertTrue(self.mock_isfile.called) self.assertTrue(self.mock_isdir.called)
def test_file(self): self.mock_isfile.return_value = True ret = mkvstrip.walk_directory("/movies/test.mkv") self.assertListEqual(ret, ["/movies/test.mkv"]) self.assertTrue(self.mock_isfile.called) self.mock_isdir.assert_not_called()