def setUp(self):
     self.fm = FileManager()
     self.dir = normpath(
         join(dirname(__file__), ('../../../../tests/'
                                  'fixtures/main/filemanager')))
     self.file = normpath(
         join(dirname(__file__), ('../../../../tests/'
                                  'fixtures/main/filemanager/a.bib')))
Exemplo n.º 2
0
    def set_path(self, path):
        self.__path = path

        # Read all the files from the given path and put them in a queue
        self.files = FileManager().get_files_list(path)
        for file in self.files:
            self._in_queue.put(file)
class TestFileManager(unittest.TestCase):

    def setUp(self):
        self.fm = FileManager()
        self.dir = normpath(join(dirname(__file__), ('../../../../tests/'
                                     'fixtures/main/filemanager')))
        self.file = normpath(join(dirname(__file__), ('../../../../tests/'
                                     'fixtures/main/filemanager/a.bib')))
        
    def tearDown(self):
        pass

    def test_get_files_dir_path(self):
        files = self.fm.get_files_list(self.dir, 'bib')
        self.failUnless(len(files) == 2)
        files = self.fm.get_files_list(self.dir, 'pdf')
        self.failUnless(len(files) == 2)
        files = self.fm.get_files_list(self.dir)
        self.failUnless(len(files) == 4)
    
    def test_get_files_file_path(self):
        files = self.fm.get_files_list(self.file)
        self.failUnless(len(files) == 1)
class TestFileManager(unittest.TestCase):
    def setUp(self):
        self.fm = FileManager()
        self.dir = normpath(
            join(dirname(__file__), ('../../../../tests/'
                                     'fixtures/main/filemanager')))
        self.file = normpath(
            join(dirname(__file__), ('../../../../tests/'
                                     'fixtures/main/filemanager/a.bib')))

    def tearDown(self):
        pass

    def test_get_files_dir_path(self):
        files = self.fm.get_files_list(self.dir, 'bib')
        self.failUnless(len(files) == 2)
        files = self.fm.get_files_list(self.dir, 'pdf')
        self.failUnless(len(files) == 2)
        files = self.fm.get_files_list(self.dir)
        self.failUnless(len(files) == 4)

    def test_get_files_file_path(self):
        files = self.fm.get_files_list(self.file)
        self.failUnless(len(files) == 1)
 def setUp(self):
     self.fm = FileManager()
     self.dir = normpath(join(dirname(__file__), ('../../../../tests/'
                                  'fixtures/main/filemanager')))
     self.file = normpath(join(dirname(__file__), ('../../../../tests/'
                                  'fixtures/main/filemanager/a.bib')))