(core) Add RenameChoices user action

Summary:
["RenameChoices", table_id, col_id, renames]
Updates the data in a Choice/ChoiceList column to reflect the new choice names.
`renames` should be a dict of `{old_choice_name: new_choice_name}`.
This doesn't touch the choices configuration in widgetOptions, that must be done separately.
Frontend to be done in another diff.

Test Plan: Added two Python unit tests.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D3050
This commit is contained in:
Alex Hall
2021-09-30 14:14:52 +02:00
parent 02fd71d9bb
commit d4ea5b3761
5 changed files with 184 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ import functools
import json
import unittest
from collections import namedtuple
from pprint import pprint
import six
@@ -203,7 +204,10 @@ class EngineTestCase(unittest.TestCase):
"""
Prints out_actions in human-readable format, for help in writing / debugging tets.
"""
print("\n".join(self._formatActionGroup(out_actions.__dict__)))
pprint({
k: [get_comparable_repr(action) for action in getattr(out_actions, k)]
for k in self.action_group_action_fields
})
def assertTableData(self, table_name, data=[], cols="all", rows="all", sort=None):
"""