Add test assertion where user is not admin of channel

This commit is contained in:
Max Brunsfeld 2023-08-04 09:51:37 -07:00
parent 7a04ee3b71
commit 1762d2c6d4

View file

@ -952,7 +952,6 @@ test_both_dbs!(test_channels_postgres, test_channels_sqlite, db, {
.unwrap();
let (channels, _) = db.get_channels_for_user(a_id).await.unwrap();
assert_eq!(
channels,
vec![
@ -1001,6 +1000,37 @@ test_both_dbs!(test_channels_postgres, test_channels_sqlite, db, {
]
);
let (channels, _) = db.get_channels_for_user(b_id).await.unwrap();
assert_eq!(
channels,
vec![
Channel {
id: zed_id,
name: "zed".to_string(),
parent_id: None,
user_is_admin: true,
},
Channel {
id: crdb_id,
name: "crdb".to_string(),
parent_id: Some(zed_id),
user_is_admin: false,
},
Channel {
id: livestreaming_id,
name: "livestreaming".to_string(),
parent_id: Some(zed_id),
user_is_admin: false,
},
Channel {
id: replace_id,
name: "replace".to_string(),
parent_id: Some(zed_id),
user_is_admin: false,
},
]
);
// Remove a single channel
db.remove_channel(crdb_id, a_id).await.unwrap();
assert!(db.get_channel(crdb_id, a_id).await.unwrap().is_none());