# Path: keyring/backend.py
# class KeyringBackendMeta(abc.ABCMeta):
# class KeyringBackend(metaclass=KeyringBackendMeta):
# class Crypter:
# class NullCrypter(Crypter):
#     def __init__(cls, name, bases, dict):
#     def __init__(self):
#     def priority(cls):
#     def viable(cls):
#     def get_viable_backends(cls):
#     def name(cls):
#     def __str__(self):
#     def get_password(self, service: str, username: str) -> Optional[str]:
#     def set_password(self, service: str, username: str, password: str) -> None:
#     def delete_password(self, service: str, username: str) -> None:
#     def get_credential(
#         self,
#         service: str,
#         username: Optional[str],
#     ) -> Optional[credentials.Credential]:
#     def set_properties_from_env(self):
#         def parse(item):
#     def encrypt(self, value):
#     def decrypt(self, value):
#     def encrypt(self, value):
#     def decrypt(self, value):
# def _load_plugins():
# def get_all_keyring():


import importlib_metadata as metadata
from keyring import backend



def test_entry_point():
    """
    Keyring provides exactly one 'keyring' console script
    that's a callable.
    """
    matches = metadata.entry_points(group='console_scripts', name='keyring')
    (script,) = matches
    assert callable(script.load())


def test_missing_metadata(monkeypatch):
    """
    _load_plugins should pass when keyring metadata is missing.
    """
    monkeypatch.setattr(metadata, 'entry_points', metadata.EntryPoints().select)

# Path: keyring/backend.py
# class KeyringBackendMeta(abc.ABCMeta):
# class KeyringBackend(metaclass=KeyringBackendMeta):
# class Crypter:
# class NullCrypter(Crypter):
#     def __init__(cls, name, bases, dict):
#     def __init__(self):
#     def priority(cls):
#     def viable(cls):
#     def get_viable_backends(cls):
#     def name(cls):
#     def __str__(self):
#     def get_password(self, service: str, username: str) -> Optional[str]:
#     def set_password(self, service: str, username: str, password: str) -> None:
#     def delete_password(self, service: str, username: str) -> None:
#     def get_credential(
#         self,
#         service: str,
#         username: Optional[str],
#     ) -> Optional[credentials.Credential]:
#     def set_properties_from_env(self):
#         def parse(item):
#     def encrypt(self, value):
#     def decrypt(self, value):
#     def encrypt(self, value):
#     def decrypt(self, value):
# def _load_plugins():
# def get_all_keyring():


# Path: tests/test_packaging.py
import importlib_metadata as metadata
from keyring import backend




def test_entry_point():
    """
    Keyring provides exactly one 'keyring' console script
    that's a callable.
    """
    matches = metadata.entry_points(group='console_scripts', name='keyring')
    (script,) = matches
    assert callable(script.load())


def test_missing_metadata(monkeypatch):
    """
    _load_plugins should pass when keyring metadata is missing.
    """
    monkeypatch.setattr(metadata, 'entry_points', metadata.EntryPoints().select)

    backend._load_plugins()