use crate::common::{validate_environment, TestFixture};
#[tokio::test]
async fn test_environment_health() {
validate_environment()
.await
.expect("Dev environment should be running and healthy");
}
#[tokio::test]
async fn test_fixture_creation() {
let fixture = TestFixture::create()
.await
.expect("Failed to create test fixture");
assert!(fixture.user_id > 0, "User ID should be positive");
assert!(fixture.org_id > 0, "Org ID should be positive");
assert!(fixture.vault_id > 0, "Vault ID should be positive");
assert!(fixture.client_id > 0, "Client ID should be positive");
assert!(
!fixture.cert_kid.is_empty(),
"Certificate KID should not be empty"
);
fixture.cleanup().await.expect("Cleanup should succeed");
}
#[tokio::test]
async fn test_jwt_generation() {
let fixture = TestFixture::create()
.await
.expect("Failed to create test fixture");
let jwt = fixture
.generate_jwt(None, &[])
.expect("JWT generation should succeed");
let parts: Vec<&str> = jwt.split('.').collect();
assert_eq!(
parts.len(),
3,
"JWT should have header.payload.signature format"
);
let jwt_write = fixture
.generate_jwt(None, &["inferadb.check", "inferadb.write"])
.expect("JWT generation with scopes should succeed");
assert!(!jwt_write.is_empty());
fixture.cleanup().await.expect("Cleanup should succeed");
}
#[tokio::test]
async fn test_sdk_client_creation() {
let fixture = TestFixture::create()
.await
.expect("Failed to create test fixture");
let client = fixture.create_sdk_client().await;
assert!(
client.is_ok(),
"SDK client creation should succeed: {:?}",
client.err()
);
fixture.cleanup().await.expect("Cleanup should succeed");
}
#[tokio::test]
async fn test_sdk_health_check() {
let fixture = TestFixture::create()
.await
.expect("Failed to create test fixture");
let client = fixture
.create_sdk_client()
.await
.expect("Failed to create SDK client");
let health_result = client.health_check().await;
println!("Health check result: {:?}", health_result);
fixture.cleanup().await.expect("Cleanup should succeed");
}