def testAllDefault(self): cleaned_kwargs = kctx.clean_kwargs(self.context, {}) self.assert_('using_keytab' in cleaned_kwargs) self.assertFalse(cleaned_kwargs['using_keytab']) self.assert_('principal' in cleaned_kwargs) principal = cleaned_kwargs['principal'] self.assertEqual(principal.name.split('@')[0], kctx.get_login()) self.assert_('ccache' in cleaned_kwargs) ccache = cleaned_kwargs['ccache'] self.assertEqual(ccache.name, krb_default_cc_name())
def testSpecifyAllManually(self): self.kwargs.update({ 'principal': config.user_principal, 'ccache_file': config.user_ccache_file, }) cleaned_kwargs = kctx.clean_kwargs(self.context, self.kwargs) self.assert_('principal' in cleaned_kwargs) test_user_princ = cleaned_kwargs['principal'] self.assertEqual( test_user_princ.name, config.user_principal, 'Principal name %s does not equal to expected %s.' % ( test_user_princ, config.user_principal)) self.assert_('ccache' in cleaned_kwargs) ccache = cleaned_kwargs['ccache'] self.assertEqual(ccache.name, config.user_ccache_file)
def testSpecifyAllManually(self): self.kwargs.update({ 'principal': config.service_principal, 'ccache_file': config.user_ccache_file, 'keytab_file': config.user_keytab_file, }) cleaned_kwargs = kctx.clean_kwargs(self.context, self.kwargs) self.assert_('ccache' in cleaned_kwargs) self.assertEqual( cleaned_kwargs['ccache'].name, config.user_ccache_file, 'Cleaned ccache %s does not equal to expected %s.' % ( cleaned_kwargs['ccache'].name, config.user_ccache_file)) self.assert_('keytab' in cleaned_kwargs) kt = cleaned_kwargs['keytab'] expected_kt_name = config.user_keytab_file self.assert_( kt.name.endswith(expected_kt_name), 'Key table %s should contain expected filename %s.' % ( kt.name, expected_kt_name))
def testAllDefault(self): self.kwargs.update({ 'principal': config.service_principal, }) cleaned_kwargs = kctx.clean_kwargs(self.context, self.kwargs) self.assert_('principal' in cleaned_kwargs) self.assertEqual( cleaned_kwargs['principal'].name, config.service_principal, 'Principal is not cleaned to proper an Principal.') self.assert_('ccache' in cleaned_kwargs) expected_ccache_file = krb_default_cc_name() self.assertEqual( cleaned_kwargs['ccache'].name, expected_ccache_file, 'Cleaned ccache %s does not equal to expected %s.' % ( cleaned_kwargs['ccache'].name, expected_ccache_file)) self.assert_('keytab' in cleaned_kwargs) kt = cleaned_kwargs['keytab'] expected_kt_name = krb_default_keytab_name() self.assertEqual(kt.name, expected_kt_name, 'Default key table should be used if not provide.')