'Calling subscribe on behalf of a principal that does not exist
should return a JSON error.'

def test_subscription_add_invalid_principal(self):

    invalid_principal = 'rosencrantz-and-guildenstern@zulip.com'
    invalid_principal_realm = get_realm('zulip')
    with self.assertRaises(UserProfile.DoesNotExist):
        get_user(invalid_principal, invalid_principal_realm)
    result = self.common_subscribe_to_streams(self.test_email, self.streams, {'principals': ujson.dumps([invalid_principal])})
    self.assert_json_error(result, ("User    not    authorized    to    execute    queries    on    behalf    of    '%s'" % (invalid_principal,)), status_code=403)
