def test_api_key(): """tests that the API key is being used""" qs = QueryService() assert b"DbName" in qs.einfo() qs = QueryService(api_key="bogus") with pytest.raises(EutilsRequestError): qs.einfo()
def __init__(self, cache=False): """ :param str cache: passed to QueryService, which see for explanation :raises EutilsError: if cache file couldn't be created """ self._qs = QueryService(cache=cache)
def __init__(self, cache_path=default_cache_path): """ :param str cache_path: full path to sqlite database file (created if necessary) :raises EutilsError: if cache file couldn't be created """ cache_dir = os.path.dirname(cache_path) if not os.path.exists(cache_dir): try: os.mkdir(cache_dir) logger.info("Made cache directory " + cache_dir) except OSError: raise EutilsError("Failed to make cache directory " + cache_dir) self._qs = QueryService(cache_path=cache_path)
def __init__(self, cache_path=default_cache_path, request_interval=0.4): self._qs = QueryService(cache_path=cache_path, request_interval=request_interval)
def setUp(self): self.qs = QueryService()