'Sends a message during user creation'

def test_add_new_user_history_race(self):

    stream_dict = {'Denmark': {'description': 'A    Scandinavian    country', 'invite_only': False}, 'Verona': {'description': 'A    city    in    Italy', 'invite_only': False}}
    realm = get_realm('zulip')
    set_default_streams(realm, stream_dict)
    with patch('zerver.lib.actions.add_new_user_history'):
        self.register(self.nonreg_email('test'), 'test')
    user_profile = self.nonreg_user('test')
    subs = Subscription.objects.select_related('recipient').filter(user_profile=user_profile, recipient__type=Recipient.STREAM)
    streams = Stream.objects.filter(id__in=[sub.recipient.type_id for sub in subs])
    self.send_message(self.example_email('hamlet'), streams[0].name, Recipient.STREAM, 'test')
    add_new_user_history(user_profile, streams)
