def test_validate_protocol_encryption_with_disabled_raises( self, file_cache: DefaultAgentFileCache) -> None: settings = {"use_regular": "disable"} fetcher = TCPFetcher( file_cache, family=socket.AF_INET, address=("1.2.3.4", 0), host_name=HostName("irrelevant_for_this_test"), timeout=0.0, encryption_settings=settings, use_only_cache=False, ) with pytest.raises(MKFetcherError): fetcher._validate_protocol(TransportProtocol.PBKDF2)
def test_validate_protocol_no_tls_with_registered_host_raises( self, file_cache: AgentFileCache) -> None: fetcher = TCPFetcher( file_cache, family=socket.AF_INET, address=("1.2.3.4", 0), host_name=HostName("irrelevant_for_this_test"), timeout=0.0, encryption_settings={}, ) for p in TransportProtocol: if p is TransportProtocol.TLS: continue with pytest.raises(MKFetcherError): fetcher._validate_protocol(p, is_registered=True)
def test_validate_protocol_plaintext_with_enforce_raises( self, file_cache: AgentFileCache) -> None: settings = {"use_regular": "enforce"} fetcher = TCPFetcher( file_cache, family=socket.AF_INET, address=("1.2.3.4", 0), host_name=HostName("irrelevant_for_this_test"), timeout=0.0, encryption_settings=settings, ) with pytest.raises(MKFetcherError): fetcher._validate_protocol(TransportProtocol.PLAIN, is_registered=False)
def test_validate_protocol_tls_required(self, file_cache: DefaultAgentFileCache) -> None: settings = {"use_regular": "tls"} fetcher = TCPFetcher( file_cache, family=socket.AF_INET, address=("1.2.3.4", 0), host_name=HostName("irrelevant_for_this_test"), timeout=0.0, encryption_settings=settings, use_only_cache=False, ) for p in TransportProtocol: if p is TransportProtocol.TLS: continue with pytest.raises(MKFetcherError, match="TLS"): fetcher._validate_protocol(p)