Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def prepare_retry_test():
urls = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'test', 'data', 'invalid-url.yaml')
config = os.path.join(os.path.dirname(__file__), 'data', 'urlwatch.yaml')
cache = os.path.join(os.path.dirname(__file__), 'data', 'cache.db')
hooks = ''
config_storage = YamlConfigStorage(config)
cache_storage = CacheMiniDBStorage(cache)
urls_storage = UrlsYaml(urls)
urlwatch_config = TestConfig(config, urls, cache, hooks, True)
urlwatcher = Urlwatch(urlwatch_config, config_storage, cache_storage, urls_storage)
return urlwatcher, cache_storage
def test_load_config_yaml():
config_json = os.path.join(os.path.dirname(__file__), 'data', 'urlwatch.yaml')
if os.path.exists(config_json):
config = YamlConfigStorage(config_json)
assert config is not None
assert config.config is not None
assert config.config == storage.DEFAULT_CONFIG
def test_run_watcher():
urls = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'share', 'urlwatch', 'examples', 'urls.yaml.example')
config = os.path.join(os.path.dirname(__file__), 'data', 'urlwatch.yaml')
cache = os.path.join(os.path.dirname(__file__), 'data', 'cache.db')
hooks = ''
config_storage = YamlConfigStorage(config)
urls_storage = UrlsYaml(urls)
cache_storage = CacheMiniDBStorage(cache)
try:
urlwatch_config = TestConfig(config, urls, cache, hooks, True)
urlwatcher = Urlwatch(urlwatch_config, config_storage, cache_storage, urls_storage)
urlwatcher.run_jobs()
finally:
cache_storage.close()