Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def assertValidateCertRaisesRuntimeError(self, expected_message, path):
with self.assertRaises(RuntimeError) as err:
validate_cert(path)
self.assertEqual(err.exception.args[0], expected_message)
def test_valid_cert(self):
path = os.path.join(self.resources_path, "valid.crt")
validate_cert(path)
logger.critical(msg)
raise RuntimeError(msg)
self._validate_cert_key_state(
"The parameter(s) {} must be set.",
SettingsParameters.CertificateFile in self.settings,
SettingsParameters.KeyFile in self.settings,
)
cert = self.settings[SettingsParameters.CertificateFile]
self._validate_cert_key_state(
"The parameter(s) {} must point to " "an existing file.",
os.path.isfile(cert),
os.path.isfile(self.settings[SettingsParameters.KeyFile]),
)
tabpy.tabpy_server.app.util.validate_cert(cert)