test helper: generate a real ConfigParser to make all its methods available

This commit is contained in:
Felix Yan 2015-11-04 23:11:59 +08:00
parent d909983f0d
commit 5db3b93dcd

View File

@ -1,3 +1,4 @@
import configparser
from tornado.ioloop import IOLoop
import tornado.testing
from nvchecker.get_version import get_version
@ -11,5 +12,12 @@ class ExternalVersionTestCase(tornado.testing.AsyncTestCase):
def get_version_callback(name, version):
self.stop(version)
get_version(name, config, get_version_callback)
if isinstance(config, dict):
_config = configparser.ConfigParser(dict_type=dict, allow_no_value=True)
_config.read_dict({name: config})
_config = _config[name]
else:
_config = config
get_version(name, _config, get_version_callback)
return self.wait()