def fetcher_fixture(self, file_cache): return TCPFetcher( file_cache, family=socket.AF_INET, address=("1.2.3.4", 6556), timeout=0.1, encryption_settings={"encryption": "settings"}, use_only_cache=False, )
def fetcher_fixture(self, monkeypatch, file_cache): # We use the TCPFetcher to test a general feature of the fetchers. return TCPFetcher( StubFileCache.from_json(file_cache.to_json()), family=socket.AF_INET, address=("1.2.3.4", 0), timeout=0.0, encryption_settings={}, use_only_cache=False, )
def fetcher_fixture(self, fc_conf): return TCPFetcher.from_json( json_identity({ "file_cache": fc_conf.configure(), "family": socket.AF_INET, "address": ["1.2.3.4", 6556], "timeout": 0.1, "encryption_settings": { "encryption": "settings" }, }))
def cache_fetcher_fixture(self, monkeypatch, fc_conf): fetcher = TCPFetcher(StubFileCache.from_json(fc_conf.configure()), socket.AF_INET, ("", 0), 0.0, {}, False) # Populate the cache assert isinstance(fetcher.file_cache, StubFileCache) fetcher.file_cache.cache = b"cached_section" # Fixate the response we get from IO monkeypatch.setattr(fetcher, "_fetch_from_io", lambda mode: b"fetched_section") return fetcher
def test_decrypt_plaintext_is_noop(self, fc_agent): settings = {"use_regular": "allow"} output = b"<<<section:sep(0)>>>\nbody\n" fetcher = TCPFetcher(fc_agent, socket.AF_INET, ("", 0), 0.0, settings) assert fetcher._decrypt(output) == output