gbserver/gb-testing/tests/integration/api_test.rs

42 lines
929 B
Rust
Raw Normal View History

2024-12-22 20:56:52 -03:00
use gb_testing::integration::{IntegrationTest, IntegrationTestCase};
use anyhow::Result;
use async_trait::async_trait;
struct ApiTest {
test: IntegrationTest,
}
#[async_trait]
impl IntegrationTestCase for ApiTest {
async fn setup(&mut self) -> Result<()> {
// Setup test environment
Ok(())
}
async fn execute(&self) -> Result<()> {
// Test API endpoints
Ok(())
}
async fn teardown(&mut self) -> Result<()> {
// Cleanup test environment
Ok(())
}
}
#[tokio::test]
async fn test_api_integration() -> Result<()> {
let mut test = ApiTest {
test: IntegrationTest {
docker: testcontainers::clients::Cli::default(),
db_pool: sqlx::PgPool::connect("postgres://postgres:postgres@localhost:5432/test").await?,
},
};
test.setup().await?;
test.execute().await?;
test.teardown().await?;
Ok(())
}