mirror of https://github.com/zulip/zulip.git
export: Export AlertWord table.
This commit is contained in:
parent
23e0ea5e32
commit
318c55e030
|
@ -30,6 +30,7 @@ from scripts.lib.zulip_tools import overwrite_symlink
|
|||
from zerver.lib.avatar_hash import user_avatar_path_from_ids
|
||||
from zerver.lib.pysa import mark_sanitized
|
||||
from zerver.models import (
|
||||
AlertWord,
|
||||
Attachment,
|
||||
BotConfigData,
|
||||
BotStorageData,
|
||||
|
@ -621,6 +622,13 @@ def get_realm_config() -> Config:
|
|||
custom_fetch=fetch_user_profile,
|
||||
)
|
||||
|
||||
Config(
|
||||
table='zerver_alertword',
|
||||
model=AlertWord,
|
||||
normal_parent=user_profile_config,
|
||||
parent_key='user_profile__in',
|
||||
)
|
||||
|
||||
user_groups_config = Config(
|
||||
table='zerver_usergroup',
|
||||
model=UserGroup,
|
||||
|
|
|
@ -447,6 +447,18 @@ class ImportExportTest(ZulipTestCase):
|
|||
{'Denmark', 'Rome', 'Scotland', 'Venice', 'Verona'},
|
||||
)
|
||||
|
||||
exported_alert_words = data['zerver_alertword']
|
||||
|
||||
# We set up 4 alert words for Hamlet, Cordelia, etc.
|
||||
# when we populate the test database.
|
||||
num_zulip_users = 9
|
||||
self.assertEqual(len(exported_alert_words), num_zulip_users * 4)
|
||||
|
||||
self.assertIn(
|
||||
'robotics',
|
||||
{r['word'] for r in exported_alert_words}
|
||||
)
|
||||
|
||||
data = full_data['message']
|
||||
um = UserMessage.objects.all()[0]
|
||||
exported_um = self.find_by_id(data['zerver_usermessage'], um.id)
|
||||
|
|
Loading…
Reference in New Issue