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(): # gellerthegy is streets=no if relation_name not in ("gazdagret", "gellerthegy"): relations.get_relation(relation_name).get_config().set_active(False) expected = util.get_content(relations.get_workdir(), "streets-reference-gazdagret.lst") os.unlink(os.path.join(relations.get_workdir(), "streets-reference-gazdagret.lst")) cron.update_ref_streets(relations) actual = util.get_content(relations.get_workdir(), "streets-reference-gazdagret.lst") self.assertEqual(actual, expected) # Make sure street ref is not created for the streets=no case. ujbuda_path = os.path.join(relations.get_workdir(), "streets-reference-gellerthegy.lst") self.assertFalse(os.path.exists(ujbuda_path))
def test_happy(self) -> None: """Tests the happy path.""" ctx = test_context.make_test_context() relations = areas.Relations(ctx) for relation_name in relations.get_active_names(): # gellerthegy is streets=no if relation_name not in ("gazdagret", "gellerthegy"): relations.get_relation(relation_name).get_config().set_active( False) path = os.path.join(relations.get_workdir(), "streets-reference-gazdagret.lst") expected = util.get_content(path) os.unlink(path) cron.update_ref_streets(ctx, relations, update=True) mtime = os.path.getmtime(path) cron.update_ref_streets(ctx, relations, update=False) self.assertEqual(os.path.getmtime(path), mtime) actual = util.get_content(path) self.assertEqual(actual, expected) # Make sure street ref is not created for the streets=no case. ujbuda_path = os.path.join(relations.get_workdir(), "streets-reference-gellerthegy.lst") self.assertFalse(os.path.exists(ujbuda_path))