def test_show_shared(self):
        """test the output of --list-shared """
        path = os.path.join(self.root_dir, u"ñoño".encode('utf-8'))
        self.fs.create(path, "")
        self.fs.set_node_id(path, "node_id")
        # helper function, pylint: disable-msg=C0111

        def fake_create_share(node_id, user, name, access_level, marker, path):
            self.main.vm.handle_AQ_CREATE_SHARE_OK(
                share_id='share_id', marker=marker)
        self.main.action_q.create_share = fake_create_share
        self.main.vm.create_share(path, 'fake_user', 'shared_name',
                                  ACCESS_LEVEL_RO)
        out = StringIO()
        expected = (
            u"Shared list:\n  id=share_id name=shared_name accepted=False "
            u"access_level=View to=fake_user path=%s\n" % path.decode('utf-8'))
        d = self.tool.list_shared()
        d.addCallback(lambda result: show_shared(result, out))

        def check(result):
            """check the output"""
            self.assertEqual(out.getvalue(), expected)
        d.addCallback(check)
        return d
    def test_show_shared_empty(self):
        """test the output of --list-shared """
        out = StringIO()
        d = self.tool.list_shared()
        d.addCallback(lambda result: show_shared(result, out))

        def check(result):
            """check the output"""
            self.assertEqual('No shared\n', out.getvalue())
        d.addCallback(check)
        return d