/
niceSOFT
/
python3-hatchling
Обзор
Документация
Войти
/
niceSOFT
/
python3-hatchling
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tests/utils/test_auth.py
48 строк
1 KB
Cary Hawkins
Code clean up. (#2097)
15 ноя 2025, 18:42
Не верифицирован
15 ноя 2025, 18:42
ff4b404
Код
Авторство
О чём код?
from hatch.publish.auth import AuthenticationCredentials from hatch.utils.fs import Path def test_pypirc(tmp_path, mocker): # Create a fake home directory fake_home = tmp_path / "home" fake_home.mkdir() # Create .pypirc in the fake home pypirc = fake_home / ".pypirc" pypirc.write_text("""\ [other] username: guido password: gat repository: https://kaashandel.nl/ [pypi] username: guido password: sprscrt """) mocker.patch.object(Path, "home", return_value=fake_home) credentials = AuthenticationCredentials( app=None, cache_dir=Path("/none"), options={}, repo="", repo_config={"url": ""} ) assert credentials.username == "guido" assert credentials.password == "sprscrt" credentials = AuthenticationCredentials( app=None, cache_dir=Path("/none"), options={}, repo="other", repo_config={"url": ""}, ) assert credentials.username == "guido" assert credentials.password == "gat" credentials = AuthenticationCredentials( app=None, cache_dir=Path("/none"), options={}, repo="arbitrary", repo_config={"url": "https://kaashandel.nl/"}, ) assert credentials.username == "guido" assert credentials.password == "gat"