def test_check_input_arguments_correct(self, mock_check_output): sql_cmd = "SELECT pg_xlogfile_name(pg_stop_backup())" pg_stop_backup() mock_check_output.assert_called_with(['psql', 'postgres', '-t', '-c', sql_cmd])
def backup_pgsql_and_return_needed_WAL_files(src_dir, archivefile, tag): first_WAL = pg_start_backup(tag) Support().notify_snapshot_started(tag, first_WAL) create_archive(src_dir, archivefile) second_WAL = pg_stop_backup() return (first_WAL, second_WAL)
def test_check_returns_WAL_filename(self, mock_check_output): mock_check_output.return_value = self.pgsql_return output = pg_stop_backup() self.assertEqual(self.WAL_FILENAME, output)