def add_info(report): """Add info to the report.""" # attach the log fname = logger.get_filename() attach_file_if_exists(report, fname, "MagicicadaLog") # which ubuntuone-client package version is installed attach_related_packages(report, ["ubuntuone-client"])
def test_attach_log_file(self): """Attach the log file.""" called = [] import source_magicicada self.patch(source_magicicada, "attach_file_if_exists", lambda *a: called.extend(a)) d = {} source_magicicada.add_info(d) self.assertIs(called[0], d) self.assertEqual(called[1], logger.get_filename()) self.assertEqual(called[2], "MagicicadaLog")
def test_log_fname_basedir(self): """The log filename using other base dir.""" fname = os.path.join('tmp', 'magicicada', 'magicicada.log') self.assertEqual(get_filename(cache_dir='tmp'), fname)
def test_log_fname_default(self): """The log filename by default.""" fname = os.path.join(xdg_cache_home, 'magicicada', 'magicicada.log') self.assertEqual(get_filename(), fname)