'Reacting with valid emoji on a historical message succeeds'

def test_valid_emoji_react_historical(self):

    realm = get_realm('zulip')
    stream_name = 'Saxony'
    self.subscribe_to_stream(self.example_email('cordelia'), stream_name, realm=realm)
    message_id = self.send_message(self.example_email('cordelia'), stream_name, Recipient.STREAM)
    user_profile = self.example_user('hamlet')
    sender = user_profile.email
    self.assertFalse(UserMessage.objects.filter(user_profile=user_profile, message_id=message_id).exists())
    result = self.client_put(('/api/v1/messages/%s/emoji_reactions/smile' % (message_id,)), **self.api_auth(sender))
    self.assert_json_success(result)
    user_message = UserMessage.objects.get(user_profile=user_profile, message_id=message_id)
    self.assertTrue(user_message.flags.historical)
    self.assertTrue(user_message.flags.read)
    self.assertFalse(user_message.flags.starred)
