def pgl(): pgl_ = PgLookout("pglookout.json") pgl_.check_for_maintenance_mode_file = Mock() pgl_.check_for_maintenance_mode_file.return_value = False pgl_.cluster_monitor._connect_to_db = Mock() # pylint: disable=protected-access pgl_.create_alert_file = Mock() pgl_.execute_external_command = Mock() try: yield pgl_ finally: pgl_.quit()
def setUp(self): self.pglookout = PgLookout("pglookout.json") self.pglookout.execute_external_command = Mock() self.state_file_path = tempfile.gettempdir() + os.sep + "state_file"