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_all_defaults(self, get_login):
get_login.return_value = 'cqi'
context = krbContext()
expected_princ = gssapi.names.Name(get_login.return_value,
gssapi.names.NameType.user)
self.assertEqual(expected_princ,
context._cleaned_options['principal'])
self.assertEqual(kctx.DEFAULT_CCACHE,
context._cleaned_options['ccache'])
self.assertFalse(context._cleaned_options['using_keytab'])
Raises:
MissingContextError
"""
if not kwargs:
default_val = True
else:
default_val = False
for arg in self._INQUIRE_ARGS:
kwargs[arg] = kwargs.get(arg, default_val)
res = rsec_contexts.inquire_context(self, **kwargs)
if (kwargs.get('initiator_name', False) and
res.initiator_name is not None):
init_name = Name(res.initiator_name)
else:
init_name = None
if (kwargs.get('target_name', False) and
res.target_name is not None):
target_name = Name(res.target_name)
else:
target_name = None
return tuples.InquireContextResult(init_name, target_name,
res.lifetime, res.mech,
res.flags, res.locally_init,
res.complete)
mechs (bool): get the mechanisms associated with the credentials
Returns:
InquireCredResult: the information about the credentials,
with None used when the corresponding argument was False
Raises:
MissingCredentialsError
InvalidCredentialsError
ExpiredCredentialsError
"""
res = rcreds.inquire_cred(self, name, lifetime, usage, mechs)
if res.name is not None:
res_name = names.Name(res.name)
else:
res_name = None
return tuples.InquireCredResult(res_name, res.lifetime,
res.usage, res.mechs)