Esempio n. 1
0
    def test_koji_login_krb_keyring(self, proxyuser):
        session = flexmock()
        expectation = session.should_receive('krb_login').once().and_return(
            True)
        kwargs = {}
        if proxyuser is not None:
            expectation.with_args(proxyuser=proxyuser)
            kwargs['proxyuser'] = proxyuser
        else:
            expectation.with_args()

        koji_login(session, **kwargs)
Esempio n. 2
0
    def test_koji_login_krb_keytab(self, proxyuser):
        session = flexmock()
        expectation = session.should_receive('krb_login').once().and_return(
            True)
        principal = 'user'
        keytab = '/keytab'
        call_kwargs = {
            'krb_principal': principal,
            'krb_keytab': keytab,
        }
        exp_kwargs = {
            'principal': principal,
            'keytab': keytab,
        }
        if proxyuser is not None:
            call_kwargs['proxyuser'] = proxyuser
            exp_kwargs['proxyuser'] = proxyuser

        expectation.with_args(**exp_kwargs)
        koji_login(session, **call_kwargs)
Esempio n. 3
0
    def test_koji_login_ssl(self, tmpdir, proxyuser, serverca):
        session = flexmock()
        expectation = session.should_receive('ssl_login').once().and_return(
            True)
        call_kwargs = {
            'ssl_certs_dir': str(tmpdir),
        }
        exp_kwargs = {
            'cert': str(tmpdir.join('cert')),
            'ca': None,
        }

        if serverca:
            serverca = tmpdir.join('serverca')
            serverca.write('spam')
            exp_kwargs['serverca'] = str(serverca)

        if proxyuser:
            call_kwargs['proxyuser'] = proxyuser
            exp_kwargs['proxyuser'] = proxyuser

        expectation.with_args(**exp_kwargs)
        koji_login(session, **call_kwargs)