Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_logging_mask(self):
instance = SampleStep()
instance.logger = LisboaLog.get_logger(__name__)
setattr(instance, "user", "admin")
setattr(instance, "password", "test")
instance.trigger()
ret = False
with open(self._log_file, mode="r", encoding="utf-8") as f:
for line in f:
if "password : ****" in line:
ret = True
break
assert ret is True
instance = FileConvert()
Helper.set_property(instance, "logger", LisboaLog.get_logger(__name__))
Helper.set_property(instance, "src_dir", self._data_dir)
Helper.set_property(instance, "src_pattern", r"test\.txt")
Helper.set_property(instance, "encoding_from", "utf-8")
Helper.set_property(instance, "encoding_to", "utf-16")
instance.execute()
with open(test_file, errors="ignore") as t:
str_utf16 = t.read()
assert str_utf16 != STR_UTF8
# set the essential attributes
instance = FileConvert()
Helper.set_property(instance, "logger", LisboaLog.get_logger(__name__))
Helper.set_property(instance, "src_dir", self._data_dir)
Helper.set_property(instance, "src_pattern", r"test\.txt")
Helper.set_property(instance, "encoding_from", "utf-16")
Helper.set_property(instance, "encoding_to", "utf-8")
instance.execute()
with open(test_file) as t:
str_utf8 = t.read()
assert str_utf8 == STR_UTF8
finally:
shutil.rmtree(self._data_dir)
def __init__(self):
self._logger = LisboaLog.get_logger(__name__)
user (str): username
password (str): password
timeout=30 (int): timeout seconds
retryTimes=3 (int): retry count
port=21 (int): port number
tls=False (bool): use secure connection
"""
self.__host = host
self.__user = user
self.__password = password
self.__timeout = timeout
self.__retryTimes = retryTimes
self.__port = port
self.__tls = tls
self._logger = LisboaLog.get_logger(__name__)
def __init__(self, obj):
"""
Args:
q: queue which stores execution target steps
cmd_args: command line arguments
"""
self._logger = LisboaLog.get_logger(__name__)
self._step = obj
# enable to regist multiple listeners
self._listeners = []
def __init__(self, pj_scenario_file, cmn_scenario_file):
self._logger = LisboaLog.get_logger(__name__)
self._pj_scenario_file = pj_scenario_file
self._cmn_scenario_file = cmn_scenario_file
def __init__(self):
self._logger = LisboaLog.get_logger(__name__)
self.__cur = None
self.__con = None
def __init__(self, dbname, tblname, returns_bool=False):
"""
Args:
dbname: database name
tblname: table name
returns_bool: return bool or not
"""
self.__sqlite_adptr = SqliteAdapter()
self.__dbname = dbname
self.__tblname = tblname
self.__returns_bool = returns_bool
self._logger = LisboaLog.get_logger(__name__)
def __init__(self):
super().__init__()
self._retry_count = 3
self._logger = LisboaLog.get_logger(__name__)