def setUp(self): avs_filename = path.join(path.dirname(__file__), '../testdata/avs.xsd') xsd_filename = path.join(path.dirname(__file__), '../testdata/sales-reporting-flat.xsd') self.dsrf_schema_parser = dsrf_schema_parser.DsrfSchemaParser( avs_filename, xsd_filename) self.logger = dsrf_logger.DSRFLogger(__name__, '/tmp/example.log', True)
def setUp(self): self.maxDiff = None # Allow self.assertMultiLineEqual to show all diffs. self.logger = dsrf_logger.DSRFLogger(__name__, '/tmp/example.log', True) self.row_validators_list = { 'FHEA': [ cell_validators.StringValidator('RecordType', self.logger, False), cell_validators.StringValidator('MessageId', self.logger, False), cell_validators.IntegerValidator('FileNumber', self.logger, False), cell_validators.IntegerValidator('NumberOfFiles', False, False) ], 'SY03': [ cell_validators.StringValidator('RecordType', self.logger, False), cell_validators.StringValidator('CommercialModelType', self.logger, False), cell_validators.StringValidator('UseType', self.logger, False), cell_validators.StringValidator('Territory', self.logger, False), cell_validators.StringValidator('ServiceDescription', self.logger, False), cell_validators.IntegerValidator('NumberOfUsages', self.logger, False) ], 'RE01': [ cell_validators.StringValidator('RecordType', self.logger, False), cell_validators.StringValidator('BlockId', self.logger, False), cell_validators.StringValidator('ReleaseReference', self.logger, False), cell_validators.StringValidator('DspReleaseId', self.logger, False) ], 'AS02': [ cell_validators.StringValidator('RecordType', self.logger, False), cell_validators.StringValidator('BlockId', self.logger, False), cell_validators.StringValidator('ResourceReference', self.logger, False), cell_validators.StringValidator('DspResourceId', self.logger, False), cell_validators.StringValidator('ISRC', self.logger, False), cell_validators.StringValidator('Title', self.logger, False) ], 'FFOO': [ cell_validators.StringValidator('RecordType', self.logger, False), cell_validators.IntegerValidator('NumberOfLines', self.logger, False) ] } self.expected_blocks = [ self.block_from_ascii(HEAD_BLOCK), self.block_from_ascii(BODY_BLOCK), self.block_from_ascii(FOOT_BLOCK) ]
def __init__(self, log_file_path): """Initializes the Report Manager. Args: log_file_path: The path of the log file, where the library logs will be written to. """ self.logger = dsrf_logger.DSRFLogger('dsrf', log_file_path) self.logger.info('>>> Running DSRF Library %s <<<' % _get_version())
def test_mismatch_file_without_fail_fast(self): self.validator = report_files_validators.ReportFilesValidator( file_name_validators.FileNameValidator(constants.FILE_NAME_COMPONENTS), dsrf_logger.DSRFLogger(__name__, '/tmp/example.log', False)) files_list = [ 'DSR_PADPIDA2014999999Z_PADPIDA2014111801Y_AdSupport_2015-02_AU_1of4_' '20150723T092522.tsv.gz', 'DSR_PADPIDA2_PADPIDA2014111801Y_AdSupport_2015-02_AU_2of4_' '20150723T092522.tsv.gz', 'DSR_PADPIDA2014999999Z_PADPIDA2014111801Y_AdSupport_2015-02_AU_3of4_' '20150723T092522.tsv.gz', 'DSR_PADPIDA2014999999Z_PADPIDA2014111801Y_AdSupport_2015-02_AU_4of4_' '20150723T092522.tsv.gz'] self.assertRaisesRegexp( error.ReportValidationFailure, 'Found 1 fatal error\\(s\\) and 0 warnings, please check log file at ' '"/tmp/example.log" for details.\nFirst error: File ', # truncated self.validator.validate_file_names, files_list)
def setUp(self): self.validator = report_files_validators.ReportFilesValidator( file_name_validators.FileNameValidator( constants.FILE_NAME_COMPONENTS), dsrf_logger.DSRFLogger(__name__, '/tmp/example.log', True))
def setUp(self): self.logger = dsrf_logger.DSRFLogger(__name__, '/tmp/example.log', True)