'Sending stopped typing notification to another user
is successful.'

def test_send_notification_to_another_user_event(self):

    sender = self.example_user('hamlet')
    recipient = self.example_user('othello')
    expected_recipients = set([sender, recipient])
    expected_recipient_emails = set([user.email for user in expected_recipients])
    expected_recipient_ids = set([user.id for user in expected_recipients])
    events = []
    with tornado_redirected_to_list(events):
        result = self.client_post('/api/v1/typing', {'to': recipient.email, 'op': 'stop'}, **self.api_auth(sender.email))
    self.assert_json_success(result)
    self.assertEqual(len(events), 1)
    event = events[0]['event']
    event_recipient_emails = set((user['email'] for user in event['recipients']))
    event_user_ids = set(events[0]['users'])
    event_recipient_user_ids = set((user['user_id'] for user in event['recipients']))
    self.assertEqual(expected_recipient_ids, event_recipient_user_ids)
    self.assertEqual(expected_recipient_ids, event_user_ids)
    self.assertEqual(event_recipient_emails, expected_recipient_emails)
    self.assertEqual(event['sender']['email'], sender.email)
    self.assertEqual(event['type'], 'typing')
    self.assertEqual(event['op'], 'stop')
