def test_readDirectories_DIR(self): par = FileParser() data = par.read_directories(DataForTest_DIR) self.assertEqual(data[0], './Epoka Lodowcowa/Epoka Lodowcowa.avi') self.assertEqual(data[1], './Kły/Sezon1/Kly1.mp4') self.assertEqual(data[2], './Kły/Sezon1/Kly2.avi') self.assertEqual(data[3], './Kły/Sezon2/Kly10.mp4') self.assertEqual(data[4], './Kły/Sezon2/Kly11.avi')
def post_ajax(self, request, *args, **kwargs): file_text = request.POST['text'] parser = FileParser() directories = parser.read_directories(file_text) movies = movies_parser(directories) log.info('Parsed {} movies'.format(len(movies))) _search_and_create_movies(movies, request.user) return self.render_json_response({}, status=200)
def test_raiseError(self): par = FileParser() self.assertRaises(TypeError, par.read_directories, 1)
def test_readDirectories_UNKNOWN(self): par = FileParser() data = par.read_directories(DataForTest_UNKNOWN) self.assertEqual(len(data), 0)