2
I need to create a unit test that validates the following code. But how can I guarantee that the test validates the downloaded and downloaded content?
if not (os.path.exists(filename)):
melius.logger.debug('Obter codigo html on-line')
codigo_html = melius.download(url)
codigo_html = codigo_html.decode('utf-8')
else:
melius.logger.debug('Obter codigo html off-line')
with open(filename) as f:
codigo_html = f.read()
melius.logger.debug(f'carregado conteudo do arquivo local "{f.name}"')
melius.logger.debug(f'Download do atos de {ano} finalizado.')
To facilitate say that the codigo_html
is the type str
and have the text: Janeiro
then just one.
self.assertIn(codigo_html, 'Janeiro')