def __init__(self, provider=None): """ Wraps Provider Args: provider (Provider): provider instance """ if provider is None: provider = OnDemand(config=config.get('provider')['ondemand']) self.provider = provider
def __init__(self, provider=None): """ Wraps Provider Args: provider (Provider): provider instance """ if provider is None: provider = Morningstar(config=config.get("provider")['morningstar']) self.provider = provider
import unittest import yaml import logging from morningstar.provider.morningstar import Morningstar logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) CONFIG_PATH = 'config-morningstar.yml.dist' CONFIG = yaml.safe_load(open(CONFIG_PATH))['provider']['morningstar'] CONFIG_LIVE = None try: from morningstar.config import config CONFIG_LIVE = config.get("provider")['morningstar'] except: logger.info("Skipping live tests.") pass class MorningstarTest(unittest.TestCase): def __init__(self, methodName: str = ...) -> None: super().__init__(methodName) self.provider = Morningstar(config=CONFIG) if CONFIG_LIVE is not None: self.provider_live = Morningstar(config=CONFIG_LIVE) def test_build_url(self): self.assertEqual('endpoint?username=foo&password=bar&json', self.provider._build_url(base="endpoint", params={}))