#[ allow( unused_imports ) ]
use super::*;
#[ test ]
#[ cfg( feature = "integration" ) ]
fn test_workspace_loading_integration()
{
println!("๐งช Manual Testing : Anthropic API Workspace Secret Loading");
println!("=========================================================");
println!("\n๐ Step 1: Testing workspace_tools directly...");
match workspace_tools::workspace()
{
Ok(ws) => {
let root_display = ws.root().display();
println!("โ
Workspace found : {root_display}");
let secret_path = ws.root().join("secret").join("-secrets.sh");
let secret_path_display = secret_path.display();
println!("๐ Secret file path : {secret_path_display}");
let secret_exists = secret_path.exists();
println!("๐ Secret file exists : {secret_exists}");
if secret_path.exists()
{
match ws.load_secret_key("ANTHROPIC_API_KEY", "-secrets.sh")
{
Ok(secret) => {
let secret_preview = &secret[..15];
let secret_len = secret.len();
println!("โ
Raw secret loaded : {secret_preview}... (length : {secret_len})");
},
Err(e) => {
println!("โ Raw secret loading failed : {e}");
}
}
}
},
Err(e) => {
println!("โ ๏ธ Workspace not found (expected when running without WORKSPACE_PATH): {e}");
println!(" Continuing with fallback secret loading tests...");
}
}
println!("\n๐ Step 2: Testing the_module::Secret::from_workspace()...");
match the_module::Secret::from_workspace()
{
Ok(secret) => {
println!("โ
the_module::Secret::from_workspace() successful!");
let key_preview = &secret.ANTHROPIC_API_KEY[..15];
println!("๐ API Key : {key_preview}...");
let key_len = secret.ANTHROPIC_API_KEY.len();
println!("๐ Length : {key_len}");
if secret.ANTHROPIC_API_KEY.starts_with("sk-ant-")
{
println!("โ
API key format is correct (starts with sk-ant-)");
} else {
println!("โ ๏ธ API key format seems incorrect");
}
},
Err(e) => {
println!("โ the_module::Secret::from_workspace() failed : {e}");
}
}
println!("\n๐ง Step 3: Testing the_module::Client::from_workspace()...");
match the_module::Client::from_workspace()
{
Ok(client) => {
println!("โ
the_module::Client::from_workspace() successful!");
let client_key_preview = &client.secret().ANTHROPIC_API_KEY[..15];
println!("๐ Client API Key : {client_key_preview}...");
println!("๐ง Client created successfully");
},
Err(e) => {
println!("โ the_module::Client::from_workspace() failed : {e}");
}
}
println!("\n๐ Step 4: Testing consistency between methods...");
let secret_result = the_module::Secret::from_workspace();
let client_result = the_module::Client::from_workspace();
match (secret_result, client_result)
{
(Ok(secret), Ok(client)) => {
if secret.ANTHROPIC_API_KEY == client.secret().ANTHROPIC_API_KEY
{
println!("โ
Both methods return the same API key - consistency verified!");
} else {
println!("โ Methods return different API keys - inconsistency detected!");
}
},
_ => {
println!("โ One or both methods failed");
}
}
println!("\n๐ Manual testing completed!");
}