* Added `from __future__ import unicode_literals` to every file so
now all strings in code are forced to be unicode strings unless
marked as byte string `b'str'` or encoded to byte string `'str'.encode('utf-8')`.
This is a large change but we have been working towards the goal of unicode
strings passed in the code so decoding external input and encoding
output as byte strings (where applicable).
Note that in Python 2 the `str` type still refers to byte strings.
* Replaced the use of `str` for `basestring` in isinstance comparison as
this was the original intention but breaks code when encoutering unicode strings.
* Marked byte strings in gtkui as the conversion to utf8 is not always handled, mostly
related to gobject signal names.
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
#
|
|
# Copyright (C) 2015 Calum Lind <calumlind@gmail.com>
|
|
#
|
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
|
# See LICENSE for more details.
|
|
#
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
from deluge.pluginmanagerbase import PluginManagerBase
|
|
|
|
from . import common
|
|
from .basetest import BaseTestCase
|
|
|
|
|
|
class PluginManagerBaseTestCase(BaseTestCase):
|
|
|
|
def set_up(self):
|
|
common.set_tmp_config_dir()
|
|
|
|
def test_get_plugin_info(self):
|
|
pm = PluginManagerBase('core.conf', 'deluge.plugin.core')
|
|
for p in pm.get_available_plugins():
|
|
for key, value in pm.get_plugin_info(p).items():
|
|
self.assertTrue(isinstance('%s: %s' % (key, value), basestring))
|
|
|
|
def test_get_plugin_info_invalid_name(self):
|
|
pm = PluginManagerBase('core.conf', 'deluge.plugin.core')
|
|
for key, value in pm.get_plugin_info('random').items():
|
|
self.assertEqual(value, 'not available')
|