From fb6e1cdeea9231bbe922e2356b733ae42bed1d85 Mon Sep 17 00:00:00 2001 From: zaaarf Date: Tue, 5 Nov 2024 19:17:01 +0100 Subject: [PATCH] feat: use single tuple in buffer fixture too --- src/tests/fixtures.rs | 62 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 12 deletions(-) diff --git a/src/tests/fixtures.rs b/src/tests/fixtures.rs index 9a0ae60..b52712c 100644 --- a/src/tests/fixtures.rs +++ b/src/tests/fixtures.rs @@ -124,8 +124,25 @@ impl ScopedFixture<(crate::Client, crate::Workspace)> for WorkspaceFixture { } } -impl ScopedFixture<(crate::Client, crate::Workspace, crate::Client, crate::Workspace)> for WorkspaceFixture { - async fn setup(&mut self) -> Result<(crate::Client, crate::Workspace, crate::Client, crate::Workspace), Box> { +impl + ScopedFixture<( + crate::Client, + crate::Workspace, + crate::Client, + crate::Workspace, + )> for WorkspaceFixture +{ + async fn setup( + &mut self, + ) -> Result< + ( + crate::Client, + crate::Workspace, + crate::Client, + crate::Workspace, + ), + Box, + > { let client = ClientFixture::of(&self.user).setup().await?; let invitee_client = ClientFixture::of( &self @@ -146,7 +163,12 @@ impl ScopedFixture<(crate::Client, crate::Workspace, crate::Client, crate::Works async fn cleanup( &mut self, - resource: Option<(crate::Client, crate::Workspace, crate::Client, crate::Workspace)>, + resource: Option<( + crate::Client, + crate::Workspace, + crate::Client, + crate::Workspace, + )>, ) { if let Some((client, _, _, _)) = resource { client.leave_workspace(&self.workspace); @@ -195,16 +217,24 @@ impl BufferFixture { impl ScopedFixture<( - (crate::Client, crate::Workspace, crate::buffer::Controller), - (crate::Client, crate::Workspace, crate::buffer::Controller), + crate::Client, + crate::Workspace, + crate::buffer::Controller, + crate::Client, + crate::Workspace, + crate::buffer::Controller, )> for BufferFixture { async fn setup( &mut self, ) -> Result< ( - (crate::Client, crate::Workspace, crate::buffer::Controller), - (crate::Client, crate::Workspace, crate::buffer::Controller), + crate::Client, + crate::Workspace, + crate::buffer::Controller, + crate::Client, + crate::Workspace, + crate::buffer::Controller, ), Box, > { @@ -230,19 +260,27 @@ impl let invitee_buffer = invitee_workspace.attach_buffer(&self.buffer).await?; Ok(( - (client, workspace, buffer), - (invitee_client, invitee_workspace, invitee_buffer), + client, + workspace, + buffer, + invitee_client, + invitee_workspace, + invitee_buffer, )) } async fn cleanup( &mut self, resource: Option<( - (crate::Client, crate::Workspace, crate::buffer::Controller), - (crate::Client, crate::Workspace, crate::buffer::Controller), + crate::Client, + crate::Workspace, + crate::buffer::Controller, + crate::Client, + crate::Workspace, + crate::buffer::Controller, )>, ) { - if let Some(((client, _, _), (_, _, _))) = resource { + if let Some((client, _, _, _, _, _)) = resource { // buffer deletion is implied in workspace deletion client.leave_workspace(&self.workspace); if let Err(e) = client.delete_workspace(&self.workspace).await {