rusty-stack 0.4.1

A comprehensive ML environment installer and platform toolkit optimized for AMD GPUs with ROCm support
Documentation
//! Test script to validate the auth flow for llama.cpp private source retrieval.
//!
//! This script tests:
//! - Auth failure with invalid/missing token
//! - Auth success with valid token (simulated)

use rusty_stack::installers::components::llama_cpp::{LlamaCppConfig, LlamaCppInstaller};

#[test]
fn test_validate_repo_access_without_token() {
    // Remove GITHUB_TOKEN to simulate missing auth
    std::env::remove_var("GITHUB_TOKEN");

    let config = LlamaCppConfig::default();
    let installer = LlamaCppInstaller::new(config);

    // This should either fail with an actionable error or succeed if the repo is public
    let result = installer.validate_repo_access();
    if let Err(err) = result {
        eprintln!("Error message: {}", err);
        // If it fails, ensure the error is actionable
        assert!(!err.is_empty());
    } // else: repo is public, no error
}

#[test]
fn test_validate_repo_access_with_invalid_token() {
    // Set an invalid token
    std::env::set_var("GITHUB_TOKEN", "invalid_token");

    let config = LlamaCppConfig::default();
    let installer = LlamaCppInstaller::new(config);

    // This should either fail with an actionable error or succeed if the repo is public.
    // In the public-repo case, the auth path is still exercised and remains valid.
    let result = installer.validate_repo_access();
    if let Err(err) = result {
        assert!(err.contains("authentication") || err.contains("403") || err.contains("401"));
        assert!(err.contains("private repo"));
    }

    // Cleanup
    std::env::remove_var("GITHUB_TOKEN");
}