def test_no_download(self): self.logger.info("Test - test_no_download") d = practitioner.RPPS(properties=self.config_2) newfilename = d.retrieve_current() self.assertIsNone(newfilename)
def __init__(self, config): """ Init class, loads config file :param config_filename: configration file name """ self.logger = logging.getLogger("app") self.logger.info("Config : %s" % config) # domain rpps or mssante. computed by naming convention of config files self.domain = None self.cfg_filename = config self.config_dir = None self.previous_filename = {} self.data_files = [] self.rss_filename = None self.rss_history = None self.stats_filename = None self.feed = None self.init_properties() self.logger.info(self.properties) self.init_feed() self.rpps_data = practitioner.RPPS(properties=self.properties)
def test_unzip(self): start_date = datetime.datetime.now() d = practitioner.RPPS(properties=self.config_1) self.logger.debug("Extract to %s" % d.local_storage) _files = d.unzip(self.zipfilename, d.local_storage) end_date = datetime.datetime.now() delta = end_date - start_date self.logger.info("Start : %s" % start_date.isoformat()) self.logger.info("End : %s" % end_date.isoformat()) self.logger.info("Delta : %s" % delta) self.logger.info(_files) self.assertEqual(len(_files), 3)
def test_root_filename(self): d = practitioner.RPPS(properties=self.config_1) fn = "PS_LibreAcces_Dipl_AutExerc_201807300827.txt" self.assertEqual(d.root_data_filename(fn), "PS_LibreAcces_Dipl_AutExerc")
def test_newer(self): self.logger.info("Test - test_newer") d = practitioner.RPPS(properties=self.config_1) self.assertTrue(d.is_newer("PS_LibreAcces_201808011050.zip")) self.assertFalse(d.is_newer("PS_LibreAcces_201408011050.zip"))