mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-21 23:04:49 +01:00
chore: cargo fmt
This commit is contained in:
parent
fb6e1cdeea
commit
e25b82aefb
3 changed files with 45 additions and 59 deletions
|
@ -65,14 +65,28 @@ async fn test_attach_and_leave_workspace() {
|
|||
|
||||
#[tokio::test]
|
||||
async fn test_invite_user_to_workspace() {
|
||||
let client_alice = ClientFixture::of("alice").setup().await.expect("failed setting up alice's client");
|
||||
let client_bob = ClientFixture::of("bob").setup().await.expect("failed setting up bob's client");
|
||||
let client_alice = ClientFixture::of("alice")
|
||||
.setup()
|
||||
.await
|
||||
.expect("failed setting up alice's client");
|
||||
let client_bob = ClientFixture::of("bob")
|
||||
.setup()
|
||||
.await
|
||||
.expect("failed setting up bob's client");
|
||||
let ws_name = uuid::Uuid::new_v4().to_string();
|
||||
|
||||
// after this we can't just fail anymore: we need to cleanup, so store errs
|
||||
client_alice.create_workspace(&ws_name).await.expect("failed creating workspace");
|
||||
let could_invite = client_alice.invite_to_workspace(&ws_name, &client_bob.current_user().name).await;
|
||||
let ws_list = client_bob.fetch_joined_workspaces().await.unwrap_or_default(); // can't fail, empty is err
|
||||
client_alice
|
||||
.create_workspace(&ws_name)
|
||||
.await
|
||||
.expect("failed creating workspace");
|
||||
let could_invite = client_alice
|
||||
.invite_to_workspace(&ws_name, &client_bob.current_user().name)
|
||||
.await;
|
||||
let ws_list = client_bob
|
||||
.fetch_joined_workspaces()
|
||||
.await
|
||||
.unwrap_or_default(); // can't fail, empty is err
|
||||
let could_delete = client_alice.delete_workspace(&ws_name).await;
|
||||
|
||||
could_invite.expect("could not invite bob");
|
||||
|
@ -224,8 +238,7 @@ async fn cannot_delete_others_workspaces() {
|
|||
#[tokio::test]
|
||||
async fn test_buffer_search() {
|
||||
WorkspaceFixture::one("alice", "test-buffer-search")
|
||||
.with(
|
||||
|(_, workspace_alice)| {
|
||||
.with(|(_, workspace_alice)| {
|
||||
let buffer_name = uuid::Uuid::new_v4().to_string();
|
||||
let workspace_alice = workspace_alice.clone();
|
||||
|
||||
|
@ -238,8 +251,7 @@ async fn test_buffer_search() {
|
|||
workspace_alice.delete_buffer(&buffer_name).await?;
|
||||
Ok(())
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,44 +3,21 @@ use super::{
|
|||
fixtures::{ClientFixture, ScopedFixture, WorkspaceFixture},
|
||||
};
|
||||
|
||||
// Moved this in client for now.
|
||||
// #[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_create() {
|
||||
WorkspaceFixture::one("alice", "test-buffer-create")
|
||||
.with(
|
||||
|(_, workspace_alice)| {
|
||||
.with(|(_, workspace_alice)| {
|
||||
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!(
|
||||
vec![buffer_name.clone()] == workspace_alice.fetch_buffers().await?
|
||||
);
|
||||
assert_or_err!(vec![buffer_name.clone()] == workspace_alice.fetch_buffers().await?);
|
||||
workspace_alice.delete_buffer(&buffer_name).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
||||
|
@ -62,7 +39,7 @@ async fn test_cant_create_buffer_twice() {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[ignore] // TODO server has no concept of buffer ownership!
|
||||
#[ignore] // TODO reference server has no concept of buffer ownership yet!
|
||||
async fn cannot_delete_others_buffers() {
|
||||
WorkspaceFixture::two("alice", "bob", "test-cannot-delete-others-buffers")
|
||||
.with(|(_, workspace_alice, _, workspace_bob)| {
|
||||
|
@ -84,10 +61,7 @@ async fn test_workspace_interactions() {
|
|||
if let Err(e) = async {
|
||||
let client_alice = ClientFixture::of("alice").setup().await?;
|
||||
let client_bob = ClientFixture::of("bob").setup().await?;
|
||||
let workspace_name = format!(
|
||||
"test-workspace-interactions-{}",
|
||||
uuid::Uuid::new_v4()
|
||||
);
|
||||
let workspace_name = format!("test-workspace-interactions-{}", uuid::Uuid::new_v4());
|
||||
|
||||
client_alice.create_workspace(&workspace_name).await?;
|
||||
let owned_workspaces = client_alice.fetch_owned_workspaces().await?;
|
||||
|
|
Loading…
Reference in a new issue