def test_dump_to_filename(self): """ Test output to file with a filename specified """ with NamedTemporaryFile() as f: zmap._write_zmap(self.catalog, f.name) f.seek(0) file_content = f.read().decode('utf-8') self.assertIn(self._expected_string(self.test_data), file_content)
def test_dump_to_file(self): """ Test output to pre-opened file """ with NamedTemporaryFile() as f: zmap._write_zmap(self.catalog, f) f.seek(0) file_content = f.read().decode("utf-8") self.assertIn(self._expected_string(self.test_data), file_content)