mattermost: Fix mirror dummy fixture data.

The channel where Snape sends message should be gryffindor-quidditch-team
and not slytherin-quidditch-team since he is mirror dummy in gryffindor.
This commit is contained in:
Vishnu KS 2019-08-31 14:32:59 +02:00
parent 7e0ea61b00
commit a743991935
2 changed files with 8 additions and 5 deletions

View File

@ -30,6 +30,6 @@
{"type":"post","post":{"team":"slytherin","channel":"slytherin-quidditch-team","user":"malfoy","message":":rofl: 4","create_at":1553166916448,"reactions":[{"user":"harry","create_at":1553167016056,"emoji_name":"peerdium"}],"replies":null}}
{"type":"post","post":{"team":"slytherin","channel":"slytherin-quidditch-team","user":"malfoy","message":"Hello folks","create_at":1553166858280,"reactions":[{"user":"harry","create_at":1553166903980,"emoji_name":"joy"}],"replies":null}}
{"type":"post","post":{"team":"gryffindor","channel":"gryffindor-common-room","user":"harry","message":"harry joined the channel.","create_at":1553165141689,"reactions":null,"replies":null}}
{"type":"post","post":{"team":"gryffindor","channel":"slytherin-quidditch-team","user":"snape","message":"Hey folks! I was always in your team. Time to go now.","create_at":1553166740759,"reactions":null,"replies":null}}
{"type":"post","post":{"team":"gryffindor","channel":"gryffindor-quidditch-team","user":"snape","message":"Hey folks! I was always in your team. Time to go now.","create_at":1553166740759,"reactions":null,"replies":null}}
{"type":"emoji","emoji":{"name":"peerdium","image":"exported_emoji/h15ni7kf1bnj7jeua4qhmctsdo/image.png"}}
{"type":"emoji","emoji":{"name":"tick","image":"exported_emoji/7u7x8ytgp78q8jir81o9ejwwnr/image.png"}}

View File

@ -19,7 +19,7 @@ from zerver.data_import.mattermost import mattermost_data_file_to_dict, process_
build_reactions, get_name_to_codepoint_dict, do_convert_data
from zerver.data_import.sequencer import IdMapper
from zerver.data_import.import_util import SubscriberHandler
from zerver.models import Reaction, UserProfile, Message, get_realm
from zerver.models import Reaction, UserProfile, Message, get_realm, get_user
class MatterMostImporter(ZulipTestCase):
logger = logging.getLogger()
@ -471,7 +471,7 @@ class MatterMostImporter(ZulipTestCase):
self.assertIn(messages['zerver_message'][0]['content'], 'harry joined the channel.\n\n')
exported_usermessage_userprofiles = self.get_set(messages['zerver_usermessage'], 'user_profile')
self.assertEqual(len(exported_usermessage_userprofiles), 2)
self.assertEqual(len(exported_usermessage_userprofiles), 3)
exported_usermessage_messages = self.get_set(messages['zerver_usermessage'], 'message')
self.assertEqual(exported_usermessage_messages, exported_messages_id)
@ -481,8 +481,11 @@ class MatterMostImporter(ZulipTestCase):
)
realm = get_realm('gryffindor')
realm_users = UserProfile.objects.filter(realm=realm)
messages = Message.objects.filter(sender__in=realm_users)
self.assertFalse(get_user("harry@zulip.com", realm).is_mirror_dummy)
self.assertFalse(get_user("ron@zulip.com", realm).is_mirror_dummy)
self.assertTrue(get_user("snape@zulip.com", realm).is_mirror_dummy)
messages = Message.objects.filter(sender__realm=realm)
for message in messages:
self.assertIsNotNone(message.rendered_content)