def _test_get_udf_path(self, suggested_path):
        """Assert that the resulting udf path is correct."""
        assert isinstance(suggested_path, unicode)
        assert suggested_path.startswith(u'~')

        path = get_udf_path(suggested_path)
        expected = suggested_path.replace(u'/', os.path.sep)
        expected = expand_user(expected.encode('utf8'))
        self.assertEqual(path, expected)
    def test_show_folders_subscribed(self):
        """Test the output of --list-folders."""
        out = StringIO()
        suggested_path = u"~/ñoño"
        path = get_udf_path(suggested_path)

        udf = UDF("folder_id", "node_id", suggested_path, path,
                  subscribed=True)
        yield self.main.vm.add_udf(udf)
        expected = u"Folder list:\n  id=folder_id subscribed=True " + \
                   u"path=%s\n" % path.decode('utf-8')
        result = yield self.tool.get_folders()
        show_folders(result, out)
        self.assertEqual(out.getvalue(), expected)