Esempio n. 1
0
    def test_api_init(self):
        os.environ.pop('PYTEST_CURRENT_TEST', None)
        assert os.environ == {}
        m_api = self.m_api
        ipa = IPAInterface(self.parser, IPA_SECTIONNAME, api=m_api)
        self.config['authenticators']['ipa'] = ipa
        ipa.finalize_init(self.config, self.parser, None)
        assert (self.config['authenticators']['ipa'] is
                IPAInterface.from_config(self.config))

        m_api.isdone.assert_called_once_with('bootstrap')
        m_api.bootstrap.assert_called_once_with(
            context='cli',
            debug=False,
            dot_ipa=u'/tmp/invalid',
            home=u'/tmp/invalid',
            log=None,
        )

        m_api.Backend.rpcclient.isconnected.return_value = False
        with ipa:
            m_api.Backend.rpcclient.connect.assert_any_call()
            m_api.Backend.rpcclient.isconnected.return_value = True
        m_api.Backend.rpcclient.disconnect.assert_any_call()

        assert os.environ == dict(
            NSS_STRICT_NOFORK='DISABLED',
            KRB5_CONFIG='/path/to/krb5.conf',
            KRB5_CLIENT_KTNAME='/path/to/custodia.keytab',
            KRB5CCNAME='FILE:/path/to/ccache',
        )
        assert ipaclient.plugins.vault.USER_CACHE_PATH == '/tmp/invalid'
Esempio n. 2
0
    def mkinstance(self, principal, section):
        self.m_get_principal.return_value = principal

        ipa = IPAInterface(self.parser, IPA_SECTIONNAME)
        self.config['authenticators']['ipa'] = ipa
        ipa.finalize_init(self.config, self.parser, None)
        assert (self.config['authenticators']['ipa'] is
                IPAInterface.from_config(self.config))

        vault = IPAVault(self.parser, section)
        self.config['stores'][section] = vault
        vault.finalize_init(self.config, self.parser, None)
        return vault
Esempio n. 3
0
 def mkinstance(self, principal, section):
     self.m_get_principal.return_value = principal
     IPAInterface(self.parser, 'auth:ipa')
     certreq = IPACertRequest(self.parser, section)
     storename = u'store:{0.backing_store}'.format(certreq)
     certreq.store = IPAVault(self.parser, storename)
     return certreq
Esempio n. 4
0
    def test_api_init(self):
        assert os.environ == {}
        m_api = self.m_api
        ipa = IPAInterface(
            self.parser,
            'auth:ipa',
            api=m_api
        )
        m_api.isdone.assert_called_once_with('bootstrap')
        m_api.bootstrap.assert_called_once_with(
            context='cli',
            debug=False,
            log=None,
        )

        m_api.Backend.rpcclient.isconnected.return_value = False
        with ipa:
            m_api.Backend.rpcclient.connect.assert_called()
            m_api.Backend.rpcclient.isconnected.return_value = True
        m_api.Backend.rpcclient.disconnect.assert_called()

        assert os.environ == dict(
            NSS_STRICT_NOFORK='DISABLED',
            KRB5_CONFIG='/path/to/krb5.conf',
            KRB5_CLIENT_KTNAME='/path/to/custodia.keytab',
            KRB5CCNAME='FILE:/path/to/ccache',
        )
Esempio n. 5
0
    def mkinstance(self, principal, section):
        self.m_get_principal.return_value = principal

        ipa = IPAInterface(self.parser, IPA_SECTIONNAME)
        self.config['authenticators']['ipa'] = ipa
        ipa.finalize_init(self.config, self.parser, None)
        assert (self.config['authenticators']['ipa'] is
                IPAInterface.from_config(self.config))

        certreq = IPACertRequest(self.parser, section)
        self.config['stores'][section] = certreq
        storename = certreq.backing_store
        storesection = u'store:{0}'.format(storename)

        vault = IPAVault(self.parser, storesection)
        self.config['stores'][storename] = vault
        vault.finalize_init(self.config, self.parser, None)

        # finalize last
        certreq.finalize_init(self.config, self.parser, None)
        return certreq
Esempio n. 6
0
 def mkinstance(self, principal, section):
     self.m_get_principal.return_value = principal
     IPAInterface(self.parser, 'auth:ipa')
     return IPAVault(self.parser, section)