def test_show_shares(self):
     """test the output of --list-shared """
     out = StringIO()
     share_path = os.path.join(self.shares_dir, u"ñoño".encode('utf-8'))
     share = Share(path=share_path, name=u"ñoño", volume_id='share_id',
                   access_level=ACCESS_LEVEL_RO, other_username='******',
                   other_visible_name=u"ñoño", accepted=False,
                   subscribed=False)
     yield self.main.vm.add_share(share)
     expected = (
         u"Shares list:\n id=share_id name=\xf1o\xf1o accepted=False "
         u"subscribed=False access_level=View from=fake_user\n")
     result = yield self.tool.get_shares()
     show_shares(result, out)
     self.assertEqual(out.getvalue(), expected)
    def test_show_shares_empty(self):
        """test the output of --list-shared """
        out = StringIO()
        d = self.tool.get_shares()
        d.addCallback(lambda result: show_shares(result, out))

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