[ Avaa Bypassed ]




Upload:

Command:

www-data@3.148.239.85: ~ $
import pytest

import keyring.backends.chainer
from keyring import backend


@pytest.fixture
def two_keyrings(monkeypatch):
    def get_two():
        class Keyring1(backend.KeyringBackend):
            priority = 1

            def get_password(self, system, user):
                return 'ring1-{system}-{user}'.format(**locals())

            def set_password(self, system, user, password):
                pass

        class Keyring2(backend.KeyringBackend):
            priority = 2

            def get_password(self, system, user):
                return 'ring2-{system}-{user}'.format(**locals())

            def set_password(self, system, user, password):
                raise NotImplementedError()

        return Keyring1(), Keyring2()

    monkeypatch.setattr('keyring.backend.get_all_keyring', get_two)


class TestChainer:
    def test_chainer_gets_from_highest_priority(self, two_keyrings):
        chainer = keyring.backends.chainer.ChainerBackend()
        pw = chainer.get_password('alpha', 'bravo')
        assert pw == 'ring2-alpha-bravo'

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
__init__.py File 0 B 0644
test_OS_X.py File 398 B 0644
test_SecretService.py File 1 KB 0644
test_Windows.py File 904 B 0644
test_chainer.py File 1.04 KB 0644
test_kwallet.py File 3.02 KB 0644