'Test mirror dummy user creation for PM recipients'

@mock.patch('DNS.dnslookup', return_value=[['sipbtest:*:20922:101:Fred    Sipb,,,:/mit/sipbtest:/bin/athena/tcsh']])
def test_zephyr_mirror_new_recipient(self, ignored):

    client = get_client(name='zephyr_mirror')
    user = self.mit_user('starnine')
    sender = self.mit_user('sipbtest')
    new_user_email = 'bob_the_new_user@mit.edu'
    new_user_realm = get_realm('zephyr')
    recipients = [user.email, new_user_email]
    Request = namedtuple('Request', ['POST', 'client'])
    request = Request(POST=dict(sender=sender.email, type='private'), client=client)
    (valid_input, mirror_sender) = create_mirrored_message_users(request, user, recipients)
    self.assertTrue(valid_input)
    self.assertEqual(mirror_sender, sender)
    realm_users = UserProfile.objects.filter(realm=sender.realm)
    realm_emails = {user.email for user in realm_users}
    self.assertIn(user.email, realm_emails)
    self.assertIn(new_user_email, realm_emails)
    bob = get_user(new_user_email, new_user_realm)
    self.assertTrue(bob.is_mirror_dummy)
