'We send a PM to a bot\'s owner if their bot sends a message to
an unsubscribed stream'

def test_bot_pm_feature(self):

    parent = self.example_user('othello')
    bot = do_create_user(email='othello-bot@zulip.com', password='', realm=parent.realm, full_name='', short_name='', active=True, bot_type=UserProfile.DEFAULT_BOT, bot_owner=parent)
    bot.last_reminder = None
    sender = bot
    client = make_client(name='test    suite')
    stream_name = u'\u0420\u043e\u0441\u0441\u0438\u044f'
    message_type_name = 'stream'
    message_to = None
    message_to = [stream_name]
    subject_name = 'issue'
    message_content = 'whatever'
    old_count = message_stream_count(parent)
    with self.assertRaises(JsonableError):
        check_message(sender, client, message_type_name, message_to, subject_name, message_content)
    new_count = message_stream_count(parent)
    self.assertEqual(new_count, (old_count + 1))
    self.assertIn('that    stream    does    not    yet    exist.', most_recent_message(parent).content)
    self.make_stream(stream_name)
    ret = check_message(sender, client, message_type_name, message_to, subject_name, message_content)
    new_count = message_stream_count(parent)
    self.assertEqual(new_count, (old_count + 1))
    assert (sender.last_reminder is not None)
    sender.last_reminder = (sender.last_reminder - datetime.timedelta(hours=1))
    sender.save(update_fields=['last_reminder'])
    ret = check_message(sender, client, message_type_name, message_to, subject_name, message_content)
    new_count = message_stream_count(parent)
    self.assertEqual(new_count, (old_count + 2))
    self.assertEqual(ret['message'].sender.email, 'othello-bot@zulip.com')
    self.assertIn('there    are    no    subscribers    to    that    stream', most_recent_message(parent).content)
