mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-21 23:04:49 +01:00
feat: use single tuple in buffer fixture too
This commit is contained in:
parent
97ee48629d
commit
fb6e1cdeea
1 changed files with 50 additions and 12 deletions
|
@ -124,8 +124,25 @@ impl ScopedFixture<(crate::Client, crate::Workspace)> for WorkspaceFixture {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ScopedFixture<(crate::Client, crate::Workspace, crate::Client, crate::Workspace)> for WorkspaceFixture {
|
impl
|
||||||
async fn setup(&mut self) -> Result<(crate::Client, crate::Workspace, crate::Client, crate::Workspace), Box<dyn Error>> {
|
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<dyn Error>,
|
||||||
|
> {
|
||||||
let client = ClientFixture::of(&self.user).setup().await?;
|
let client = ClientFixture::of(&self.user).setup().await?;
|
||||||
let invitee_client = ClientFixture::of(
|
let invitee_client = ClientFixture::of(
|
||||||
&self
|
&self
|
||||||
|
@ -146,7 +163,12 @@ impl ScopedFixture<(crate::Client, crate::Workspace, crate::Client, crate::Works
|
||||||
|
|
||||||
async fn cleanup(
|
async fn cleanup(
|
||||||
&mut self,
|
&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 {
|
if let Some((client, _, _, _)) = resource {
|
||||||
client.leave_workspace(&self.workspace);
|
client.leave_workspace(&self.workspace);
|
||||||
|
@ -195,16 +217,24 @@ impl BufferFixture {
|
||||||
|
|
||||||
impl
|
impl
|
||||||
ScopedFixture<(
|
ScopedFixture<(
|
||||||
(crate::Client, crate::Workspace, crate::buffer::Controller),
|
crate::Client,
|
||||||
(crate::Client, crate::Workspace, crate::buffer::Controller),
|
crate::Workspace,
|
||||||
|
crate::buffer::Controller,
|
||||||
|
crate::Client,
|
||||||
|
crate::Workspace,
|
||||||
|
crate::buffer::Controller,
|
||||||
)> for BufferFixture
|
)> for BufferFixture
|
||||||
{
|
{
|
||||||
async fn setup(
|
async fn setup(
|
||||||
&mut self,
|
&mut self,
|
||||||
) -> Result<
|
) -> Result<
|
||||||
(
|
(
|
||||||
(crate::Client, crate::Workspace, crate::buffer::Controller),
|
crate::Client,
|
||||||
(crate::Client, crate::Workspace, crate::buffer::Controller),
|
crate::Workspace,
|
||||||
|
crate::buffer::Controller,
|
||||||
|
crate::Client,
|
||||||
|
crate::Workspace,
|
||||||
|
crate::buffer::Controller,
|
||||||
),
|
),
|
||||||
Box<dyn Error>,
|
Box<dyn Error>,
|
||||||
> {
|
> {
|
||||||
|
@ -230,19 +260,27 @@ impl
|
||||||
let invitee_buffer = invitee_workspace.attach_buffer(&self.buffer).await?;
|
let invitee_buffer = invitee_workspace.attach_buffer(&self.buffer).await?;
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
(client, workspace, buffer),
|
client,
|
||||||
(invitee_client, invitee_workspace, invitee_buffer),
|
workspace,
|
||||||
|
buffer,
|
||||||
|
invitee_client,
|
||||||
|
invitee_workspace,
|
||||||
|
invitee_buffer,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn cleanup(
|
async fn cleanup(
|
||||||
&mut self,
|
&mut self,
|
||||||
resource: Option<(
|
resource: Option<(
|
||||||
(crate::Client, crate::Workspace, crate::buffer::Controller),
|
crate::Client,
|
||||||
(crate::Client, crate::Workspace, crate::buffer::Controller),
|
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
|
// buffer deletion is implied in workspace deletion
|
||||||
client.leave_workspace(&self.workspace);
|
client.leave_workspace(&self.workspace);
|
||||||
if let Err(e) = client.delete_workspace(&self.workspace).await {
|
if let Err(e) = client.delete_workspace(&self.workspace).await {
|
||||||
|
|
Loading…
Reference in a new issue