async def test_init_env_var_refresh_token_only(self, monkeypatch): monkeypatch.delenv("asyncdex_username", raising=False) monkeypatch.delenv("asyncdex_password", raising=False) monkeypatch.setenv("asyncdex_refresh_token", "test") async with MangadexClient.from_environment_variables() as client: assert not client.anonymous_mode assert not client.username assert not client.password assert client.refresh_token assert not client.session_token
async def test_init_env_var_alternate_names(self, monkeypatch): monkeypatch.setenv("au", "test") monkeypatch.setenv("ap", "test") monkeypatch.setenv("art", "test") async with MangadexClient.from_environment_variables( username_variable_name="au", password_variable_name="ap", refresh_token_variable_name="art") as client: assert not client.anonymous_mode assert client.username assert client.password assert client.refresh_token assert not client.session_token