Пример #1
0
 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():
             if relation_name not in ("gazdagret", "ujbuda"):
                 relations.get_relation(
                     relation_name).get_config().set_active(False)
         config = webframe.get_config()
         expected = util.get_content(
             relations.get_workdir(),
             "street-housenumbers-reference-gazdagret.lst")
         os.unlink(
             os.path.join(relations.get_workdir(),
                          "street-housenumbers-reference-gazdagret.lst"))
         cron.update_ref_housenumbers(relations, config)
         actual = util.get_content(
             relations.get_workdir(),
             "street-housenumbers-reference-gazdagret.lst")
         self.assertEqual(actual, expected)
         # Make sure housenumber ref is not created for the streets=only case.
         ujbuda_path = os.path.join(
             relations.get_workdir(),
             "street-housenumbers-reference-ujbuda.lst")
         self.assertFalse(os.path.exists(ujbuda_path))
Пример #2
0
 def test_happy(self) -> None:
     """Tests the happy path."""
     relations = get_relations()
     for relation_name in relations.get_active_names():
         if relation_name not in ("gazdagret", "ujbuda"):
             relations.get_relation(relation_name).get_config().set_active(False)
     path = os.path.join(relations.get_workdir(), "street-housenumbers-reference-gazdagret.lst")
     expected = util.get_content(path)
     os.unlink(path)
     cron.update_ref_housenumbers(relations, update=True)
     mtime = os.path.getmtime(path)
     cron.update_ref_housenumbers(relations, update=False)
     self.assertEqual(os.path.getmtime(path), mtime)
     actual = util.get_content(path)
     self.assertEqual(actual, expected)
     # Make sure housenumber ref is not created for the streets=only case.
     ujbuda_path = os.path.join(relations.get_workdir(), "street-housenumbers-reference-ujbuda.lst")
     self.assertFalse(os.path.exists(ujbuda_path))