def test_happy(self) -> None: """Tests the happy path.""" with unittest.mock.patch('util.get_abspath', get_abspath): relations = get_relations() for relation_name in relations.get_active_names(): # ujbuda is streets=only if relation_name not in ("gazdagret", "ujbuda"): relations.get_relation(relation_name).get_config().set_active(False) expected = util.get_content(relations.get_workdir(), "gazdagret.percent") os.unlink(os.path.join(relations.get_workdir(), "gazdagret.percent")) cron.update_missing_housenumbers(relations) actual = util.get_content(relations.get_workdir(), "gazdagret.percent") self.assertEqual(actual, expected) # Make sure housenumber stat is not created for the streets=only case. self.assertFalse(os.path.exists(os.path.join(relations.get_workdir(), "ujbuda.percent")))
def test_happy(self) -> None: """Tests the happy path.""" relations = get_relations() for relation_name in relations.get_active_names(): # ujbuda is streets=only if relation_name not in ("gazdagret", "ujbuda"): relations.get_relation(relation_name).get_config().set_active(False) path = os.path.join(relations.get_workdir(), "gazdagret.percent") expected = util.get_content(path) os.unlink(path) cron.update_missing_housenumbers(relations, update=True) mtime = os.path.getmtime(path) cron.update_missing_housenumbers(relations, update=False) self.assertEqual(os.path.getmtime(path), mtime) actual = util.get_content(path) self.assertEqual(actual, expected) # Make sure housenumber stat is not created for the streets=only case. self.assertFalse(os.path.exists(os.path.join(relations.get_workdir(), "ujbuda.percent")))