mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-21 23:04:49 +01:00
test: moved around previously existing tests. and other formatter shenanigans
This commit is contained in:
parent
7f17d1fd6e
commit
3773ebfd7d
1 changed files with 37 additions and 1 deletions
|
@ -3,7 +3,6 @@ use super::{
|
|||
fixtures::{ClientFixture, ScopedFixture, WorkspaceFixture},
|
||||
};
|
||||
use crate::api::{AsyncReceiver, AsyncSender};
|
||||
use super::{assert_or_err, fixtures::{ScopedFixture, WorkspaceFixture}};
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_workspace_creation_and_lookup() {
|
||||
|
@ -242,6 +241,43 @@ async fn test_invite_user_to_workspace_and_invited_lookup() {
|
|||
}
|
||||
|
||||
// Now we can use workspace fixtures with invite.
|
||||
|
||||
#[tokio::test]
|
||||
async fn cannot_delete_others_workspaces() {
|
||||
WorkspaceFixture::two("alice", "bob", "test-cannot-delete-others-workspaces")
|
||||
.with(|((_, ws_alice), (client_bob, _))| {
|
||||
let ws_alice = ws_alice.clone();
|
||||
let client_bob = client_bob.clone();
|
||||
async move {
|
||||
assert_or_err!(
|
||||
client_bob.delete_workspace(&ws_alice.id()).await.is_err(),
|
||||
"bob was allowed to delete a workspace he didn't own!"
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_buffer_search() {
|
||||
WorkspaceFixture::one("alice", "test-buffer-search")
|
||||
.with(
|
||||
|(_, workspace_alice): &mut (crate::Client, crate::Workspace)| {
|
||||
let buffer_name = uuid::Uuid::new_v4().to_string();
|
||||
let workspace_alice = workspace_alice.clone();
|
||||
|
||||
async move {
|
||||
workspace_alice.create_buffer(&buffer_name).await?;
|
||||
assert_or_err!(!workspace_alice
|
||||
.search_buffers(Some(&buffer_name[0..4]))
|
||||
.is_empty());
|
||||
assert_or_err!(workspace_alice.search_buffers(Some("_")).is_empty());
|
||||
workspace_alice.delete_buffer(&buffer_name).await?;
|
||||
Ok(())
|
||||
}
|
||||
},
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue