mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add 'user' variable to trigger formulas
Summary: The 'user' variable has a similar API to the one from access rules: it contains properties about a user, such as their full name and email address, as well as optional, user-defined attributes that are populated via user attribute tables. Test Plan: Python unit tests. Reviewers: alexmojaki, paulfitz, dsagal Reviewed By: alexmojaki, dsagal Subscribers: paulfitz, dsagal, alexmojaki Differential Revision: https://phab.getgrist.com/D2898
This commit is contained in:
@@ -309,18 +309,27 @@ class TestRenames(test_engine.EngineTestCase):
|
||||
]})
|
||||
|
||||
def test_rename_table_autocomplete(self):
|
||||
user = {
|
||||
'Name': 'Foo',
|
||||
'UserID': 1,
|
||||
'LinkKey': {},
|
||||
'Origin': None,
|
||||
'Email': 'foo@example.com',
|
||||
'Access': 'owners'
|
||||
}
|
||||
|
||||
# Renaming a table should not leave the old name available for auto-complete.
|
||||
self.load_sample(self.sample)
|
||||
names = {"People", "Persons"}
|
||||
self.assertEqual(
|
||||
names.intersection(self.engine.autocomplete("Pe", "Address", "city")),
|
||||
names.intersection(self.engine.autocomplete("Pe", "Address", "city", user)),
|
||||
{"People"}
|
||||
)
|
||||
|
||||
# Rename the table and ensure that "People" is no longer present among top-level names.
|
||||
out_actions = self.apply_user_action(["RenameTable", "People", "Persons"])
|
||||
self.assertEqual(
|
||||
names.intersection(self.engine.autocomplete("Pe", "Address", "city")),
|
||||
names.intersection(self.engine.autocomplete("Pe", "Address", "city", user)),
|
||||
{"Persons"}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user