Skip to content

Commit

Permalink
Merge pull request #86 from supabase/delete-tenant-idempotent
Browse files Browse the repository at this point in the history
delete tenant API always returns ok
  • Loading branch information
imor authored Feb 4, 2025
2 parents b430a22 + cb308db commit 6b4912a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions api/src/routes/tenants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,7 @@ pub async fn delete_tenant(
tenant_id: Path<String>,
) -> Result<impl Responder, TenantError> {
let tenant_id = tenant_id.into_inner();
db::tenants::delete_tenant(&pool, &tenant_id)
.await?
.ok_or(TenantError::TenantNotFound(tenant_id))?;
db::tenants::delete_tenant(&pool, &tenant_id).await?;
Ok(HttpResponse::Ok().finish())
}

Expand Down
4 changes: 2 additions & 2 deletions api/tests/api/tenants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,15 @@ async fn an_existing_tenant_can_be_deleted() {
}

#[tokio::test]
async fn a_non_existing_tenant_cant_be_deleted() {
async fn a_non_existing_tenant_returns_ok_when_deleted() {
// Arrange
let app = spawn_app().await;

// Act
let response = app.delete_tenant("42").await;

// Assert
assert_eq!(response.status(), StatusCode::NOT_FOUND);
assert_eq!(response.status(), StatusCode::OK);
}

#[tokio::test]
Expand Down

0 comments on commit 6b4912a

Please sign in to comment.