mirror of https://github.com/buster-so/buster.git
Fix tests module naming conflicts and unused variable warnings
This commit is contained in:
parent
e264889c72
commit
d871818435
|
@ -115,7 +115,7 @@ pub async fn list_shares(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod list_shares_tests {
|
||||||
// We're not using any imports yet since these are placeholder tests
|
// We're not using any imports yet since these are placeholder tests
|
||||||
|
|
||||||
// This test is a skeleton and would need a proper test database setup
|
// This test is a skeleton and would need a proper test database setup
|
||||||
|
@ -189,9 +189,7 @@ pub async fn list_shares_by_identity_type(
|
||||||
anyhow!("Database connection error: {}", e)
|
anyhow!("Database connection error: {}", e)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let mut results = Vec::new();
|
let results = if identity_type == IdentityType::User {
|
||||||
|
|
||||||
if identity_type == IdentityType::User {
|
|
||||||
// Query permissions with user information
|
// Query permissions with user information
|
||||||
let permissions_with_users: Vec<(AssetPermission, User)> = asset_permissions::table
|
let permissions_with_users: Vec<(AssetPermission, User)> = asset_permissions::table
|
||||||
.inner_join(users::table.on(asset_permissions::identity_id.eq(users::id)))
|
.inner_join(users::table.on(asset_permissions::identity_id.eq(users::id)))
|
||||||
|
@ -208,7 +206,7 @@ pub async fn list_shares_by_identity_type(
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
// Convert to AssetPermissionWithUser format
|
// Convert to AssetPermissionWithUser format
|
||||||
results = permissions_with_users
|
permissions_with_users
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(permission, user)| {
|
.map(|(permission, user)| {
|
||||||
let user_info = UserInfo {
|
let user_info = UserInfo {
|
||||||
|
@ -223,7 +221,7 @@ pub async fn list_shares_by_identity_type(
|
||||||
user: Some(user_info),
|
user: Some(user_info),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect();
|
.collect()
|
||||||
} else {
|
} else {
|
||||||
// For non-user identities (like teams)
|
// For non-user identities (like teams)
|
||||||
let permissions: Vec<AssetPermission> = asset_permissions::table
|
let permissions: Vec<AssetPermission> = asset_permissions::table
|
||||||
|
@ -238,14 +236,14 @@ pub async fn list_shares_by_identity_type(
|
||||||
anyhow!("Database error: {}", e)
|
anyhow!("Database error: {}", e)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
results = permissions
|
permissions
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|permission| AssetPermissionWithUser {
|
.map(|permission| AssetPermissionWithUser {
|
||||||
permission: SerializableAssetPermission::from(permission),
|
permission: SerializableAssetPermission::from(permission),
|
||||||
user: None,
|
user: None,
|
||||||
})
|
})
|
||||||
.collect();
|
.collect()
|
||||||
}
|
};
|
||||||
|
|
||||||
info!(
|
info!(
|
||||||
asset_id = %asset_id,
|
asset_id = %asset_id,
|
||||||
|
@ -259,11 +257,7 @@ pub async fn list_shares_by_identity_type(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod list_shares_by_identity_type_tests {
|
||||||
use super::*;
|
|
||||||
use database::enums::{AssetType, IdentityType};
|
|
||||||
use uuid::Uuid;
|
|
||||||
|
|
||||||
// Additional tests would be implemented here, using a test database
|
// Additional tests would be implemented here, using a test database
|
||||||
// or mocks for database interactions
|
// or mocks for database interactions
|
||||||
}
|
}
|
Loading…
Reference in New Issue