Exemplo n.º 1
0
    def import_dir(self, directory, config, contractor, doc_category,
                   trs_category, TrsValidator, CsvLineValidator):
        """Start the import task for a single directory."""
        logger.info('Starting import of trs in %s' % directory)

        trsImport = TrsImport(
            directory,
            tobechecked_dir=config['TO_BE_CHECKED_DIR'],
            accepted_dir=config['ACCEPTED_DIR'],
            rejected_dir=config['REJECTED_DIR'],
            email_list=config['EMAIL_LIST'],
            contractor=contractor,
            doc_category=doc_category,
            trs_category=trs_category,
            trs_validator=TrsValidator,
            csv_line_validator=CsvLineValidator,
        )
        trsImport.do_import()
Exemplo n.º 2
0
    def import_dir(self, directory, config, contractor, doc_category,
                   trs_category, TrsValidator, CsvLineValidator):
        """Start the import task for a single directory."""
        logger.info('Starting import of trs in %s' % directory)

        trsImport = TrsImport(
            directory,
            tobechecked_dir=config['TO_BE_CHECKED_DIR'],
            accepted_dir=config['ACCEPTED_DIR'],
            rejected_dir=config['REJECTED_DIR'],
            email_list=config['EMAIL_LIST'],
            contractor=contractor,
            doc_category=doc_category,
            trs_category=trs_category,
            trs_validator=TrsValidator,
            csv_line_validator=CsvLineValidator,
        )
        trsImport.do_import()
Exemplo n.º 3
0
 def setUp(self):
     self.trs_import = TrsImport(
         trs_dir='/tmp/dummy_dir/FAC10005-CTR-CLT-TRS-00001',
         tobechecked_dir='/tmp/dummy_dir',
         accepted_dir='/tmp/dummy_dir',
         rejected_dir='/tmp/dummy_dir',
         email_list=['*****@*****.**', '*****@*****.**'],
         contractor='dummy_dir',
         doc_category=CategoryFactory(),
         trs_category=CategoryFactory(),
     )
     self.trs_import._errors = {
         'error1': 'This is error 1',
         'error2': 'This is error 2',
     }
     self.report = ErrorReport(self.trs_import)
Exemplo n.º 4
0
    def prepare_fixtures(self, fixtures_dir, trs_dir):
        """Create the fixtures import dir."""
        src = os.path.join(os.path.dirname(__file__), 'fixtures', fixtures_dir)
        dest = self.config['INCOMING_DIR']
        copytree(src, dest)

        trs_fullname = join(self.config['INCOMING_DIR'], trs_dir)
        trs_import = TrsImport(
            trs_fullname,
            tobechecked_dir=self.config['TO_BE_CHECKED_DIR'],
            accepted_dir=self.config['ACCEPTED_DIR'],
            rejected_dir=self.config['REJECTED_DIR'],
            email_list=self.config['EMAIL_LIST'],
            contractor=fixtures_dir,
            doc_category=self.doc_category,
            trs_category=self.trs_category,
        )
        return trs_import