def METHOD_NAME(runner, empty_netrc, user):
    with runner.isolated_filesystem(), mock.patch(
        "wandb.sdk.lib.apikey.len", return_value=40
    ):
        with open("netrc", "w") as f:
            f.write("previous config")
        result = runner.invoke(cli.login, [user])
        debug_result(result, "login")
        result = runner.invoke(cli.init, input=f"y\n{user}\nvanpelt\n")
        debug_result(result, "init")
        assert result.exit_code == 0
        with open("netrc") as f:
            generated_netrc = f.read()
        with open("wandb/settings") as f:
            generated_wandb = f.read()
        assert user in generated_netrc
        assert user in generated_wandb