def test_all_config_items_missing(self): """Assert behavior when all config items are missing.""" config = {'some_meaningless_other_key': 'boring_value'} config = buildsys.get_krb_conf(config) self.assertEqual(config, {})
def test_krb_principal(self): """Assert behavior when only krb_prinicpal is present.""" config = {'some_meaningless_other_key': 'boring_value', 'krb_principal': 'a_principal'} config = buildsys.get_krb_conf(config) self.assertEqual(config, {'principal': 'a_principal'})
def test_complete_config(self): """Assert behavior with a config that has all possible elements.""" config = {'some_meaningless_other_key': 'boring_value', 'krb_ccache': 'a_ccache', 'krb_keytab': 'a_keytab', 'krb_principal': 'a_principal'} config = buildsys.get_krb_conf(config) self.assertEqual(config, {'ccache': 'a_ccache', 'keytab': 'a_keytab', 'principal': 'a_principal'})
def test_krb_keytab(self): """Assert behavior when only krb_keytab is present.""" config = { 'some_meaningless_other_key': 'boring_value', 'krb_keytab': 'a_keytab' } config = buildsys.get_krb_conf(config) assert config == {'keytab': 'a_keytab'}
def test_krb_ccache_uid(self): """Assert behavior for krb ccache uid replacement.""" config = { 'some_meaningless_other_key': 'boring_value', 'krb_ccache': 'a_ccache_%{uid}' } config = buildsys.get_krb_conf(config) assert config == {'ccache': 'a_ccache_%d' % os.geteuid()}