def test_register_email_from_env(monkeypatch: MonkeyPatch, tmp_path: Path) -> None: monkeypatch.setenv("BENTO_EMAIL", "*****@*****.**") ctx = click.Context(cli) context = Context(base_path=INTEGRATION / "simple") context.is_init = True ctx.obj = context registrar = Registrar(click_context=ctx, agree=False) assert registrar.email == "*****@*****.**"
def tmp_config(tmp_path: Path) -> Iterator[click.Context]: click_context = click.Context(cli) context = Context(base_path=INTEGRATION / "simple") context.is_init = True click_context.obj = context memo = os.environ.get("SHELL") with patch("bento.constants.GLOBAL_CONFIG_PATH", tmp_path / "config.yml"): try: if memo: del os.environ["SHELL"] yield (click_context) finally: if memo: os.environ["SHELL"] = memo