Exemplo n.º 1
0
    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')
Exemplo n.º 2
0
    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')
Exemplo n.º 3
0
    def post_ajax(self, request, *args, **kwargs):
        file_text = request.POST['text']

        parser = FileParser()
        directories = parser.read_directories(file_text)
        movies = movies_parser(directories)

        # Mario can add movies to data base

        response_dict = {'response': file_text}
        return self.render_json_response(response_dict, status=200)
Exemplo n.º 4
0
    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)
Exemplo n.º 5
0
Arquivo: views.py Projeto: jchmura/PMD
    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)
Exemplo n.º 6
0
 def test_raiseError(self):
     par = FileParser()
     self.assertRaises(TypeError, par.read_directories, 1)
Exemplo n.º 7
0
    def test_readDirectories_UNKNOWN(self):
        par = FileParser()
        data = par.read_directories(DataForTest_UNKNOWN)

        self.assertEqual(len(data), 0)
Exemplo n.º 8
0
    def test_readDirectories_UNKNOWN(self):
        par = FileParser()
        data = par.read_directories(DataForTest_UNKNOWN)

        self.assertEqual(len(data), 0)