'Test that a new user invited to a stream receives some initial
history but only from public streams.'

def test_invite_user_signup_initial_history(self):

    self.login(self.example_email('hamlet'))
    user_profile = self.example_user('hamlet')
    private_stream_name = 'Secret'
    self.make_stream(private_stream_name, invite_only=True)
    self.subscribe_to_stream(user_profile.email, private_stream_name)
    public_msg_id = self.send_message(self.example_email('hamlet'), 'Denmark', Recipient.STREAM, 'Public    topic', 'Public    message')
    secret_msg_id = self.send_message(self.example_email('hamlet'), private_stream_name, Recipient.STREAM, 'Secret    topic', 'Secret    message')
    invitee = self.nonreg_email('alice')
    self.assert_json_success(self.invite(invitee, [private_stream_name, 'Denmark']))
    self.assertTrue(find_key_by_email(invitee))
    self.submit_reg_form_for_user(invitee, 'password')
    invitee_profile = self.nonreg_user('alice')
    invitee_msg_ids = [um.message_id for um in UserMessage.objects.filter(user_profile=invitee_profile)]
    self.assertTrue((public_msg_id in invitee_msg_ids))
    self.assertFalse((secret_msg_id in invitee_msg_ids))
