def test_check_input_arguments_correct_for_8_3(self, mock_check_output, mock_vers): mock_vers.return_value = '8.3' cmd_prefix = "SELECT pg_xlogfile_name(pg_start_backup('" label = 'label' cmd_suffix = "'));" sql_cmd = ''.join([cmd_prefix, label, cmd_suffix]) pg_start_backup(label) mock_vers.assert_called_once_with() 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_function_returns_WAL_filename(self, mock_check_output, mock_vers): mock_vers.return_value = '8.4' mock_check_output.return_value = self.pgsql_return output = pg_start_backup('label') self.assertEqual(self.WAL_FILENAME, output)