コード例 #1
0
 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,
     )
コード例 #2
0
 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,
     )
コード例 #3
0
 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"
             },
         }))
コード例 #4
0
    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
コード例 #5
0
    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