Test fix for security scanner

This commit is contained in:
zandercymatics 2023-10-12 14:55:01 -06:00
parent dfec8c200e
commit fa6ed6f318
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
3 changed files with 7 additions and 1 deletions

View file

@ -45,6 +45,9 @@ except NameError:
# Attn: these imports should NOT be at the top of the file # Attn: these imports should NOT be at the top of the file
try: try:
from .client import CLIENT, commands from .client import CLIENT, commands
except ImportError:
pass
try:
from .errors import RegistryError, ErrorCode from .errors import RegistryError, ErrorCode
from epplib.models import common, info from epplib.models import common, info
from epplib.responses import extensions from epplib.responses import extensions

View file

@ -74,6 +74,8 @@ class EPPLibWrapper:
} }
self._pool = None self._pool = None
# Since we reuse the same creds for each pool, we can test on
# one socket, and if successful, then we know we can connect.
if not settings.DEBUG or self._test_registry_connection_success(): if not settings.DEBUG or self._test_registry_connection_success():
self._pool = EppConnectionPool( self._pool = EppConnectionPool(
client=self._client, login=self._login, options=options client=self._client, login=self._login, options=options

View file

@ -42,7 +42,8 @@ class Socket:
return code >= 2000 return code >= 2000
def test_connection_success(self): def test_connection_success(self):
"""Tests if a successful connection can be made with the registry""" """Tests if a successful connection can be made with the registry.
Tries 3 times"""
# Something went wrong if this doesn't exist # Something went wrong if this doesn't exist
if not hasattr(self.client, "connect"): if not hasattr(self.client, "connect"):
return False return False