class TestIEController(unittest.TestCase): def setUp(self): factory = UtilFactory() self.rec = ReferencesController(factory, ReferenceFormat.BIBTEX) self.path = normpath(join(dirname(__file__), ('../../../../tests/' 'fixtures/references/bibtex/import.bib'))) def tearDown(self): pass def test_persist_file_references(self): self.rec.persist_file_references(self.path)
class TestIEController(unittest.TestCase): def setUp(self): factory = UtilFactory() self.rec = ReferencesController(factory, ReferenceFormat.BIBTEX) self.path = normpath( join(dirname(__file__), ('../../../../tests/' 'fixtures/references/bibtex/import.bib'))) def tearDown(self): pass def test_persist_file_references(self): self.rec.persist_file_references(self.path)
class ReferenceImporter(threading.Thread): def __init__(self, format=ReferenceFormat.BIBTEX): super(ReferenceImporter, self).__init__() self.name = 'Importer' self.format = format self.util_factory = UtilFactory() self.ref_controller = ReferencesController(self.util_factory, self.format) self.path = '' def get_path(self): return self.__path def set_path(self, value): self.__path = value def import_references(self, path): log.info('Importing references from %s' % path) #@UndefinedVariable references = self.ref_controller.persist_file_references(path) return len(references) def run(self): if not self.path: return self.import_references(self.path) path = property(get_path, set_path)
class ReferenceImporter(threading.Thread): def __init__(self, format=ReferenceFormat.BIBTEX): super(ReferenceImporter, self).__init__() self.name = 'Importer' self.format = format self.util_factory = UtilFactory() self.ref_controller = ReferencesController(self.util_factory, self.format) self.path = '' def get_path(self): return self.__path def set_path(self, value): self.__path = value def import_references(self, path): log.info('Importing references from %s' % path) #@UndefinedVariable references = self.ref_controller.persist_file_references(path) return len(references) def run(self): if not self.path: return self.import_references(self.path) path = property(get_path, set_path)