From 146ef9cb8c1adaf9ab39c4d70f7f4d0b7ff076da Mon Sep 17 00:00:00 2001 From: Zack Fu Zi Xiang Date: Mon, 17 Jun 2024 23:05:51 +0800 Subject: [PATCH] chore: add client and test for collab workspace deletion --- tests/workspace/publish.rs | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/tests/workspace/publish.rs b/tests/workspace/publish.rs index 077c098e..d527587d 100644 --- a/tests/workspace/publish.rs +++ b/tests/workspace/publish.rs @@ -66,11 +66,6 @@ async fn test_set_publish_namespace_set() { #[tokio::test] async fn test_publish_doc() { - #[derive(serde::Serialize, serde::Deserialize)] - struct Metadata { - title: String, - } - let (c, _user) = generate_unique_registered_user_client().await; let workspace_id = get_first_workspace_string(&c).await; let my_namespace = uuid::Uuid::new_v4().to_string(); @@ -118,6 +113,29 @@ async fn test_publish_doc() { .unwrap(); assert!(collab_data == "some_collab_data"); } + + c.delete_published_collab(&workspace_id, my_doc_name) + .await + .unwrap(); + + { + // Deleted collab should not be accessible + let guest_client = localhost_client(); + let err = guest_client + .get_published_collab::(&my_namespace, my_doc_name) + .await + .err() + .unwrap(); + assert_eq!(format!("{:?}", err.code), "RecordNotFound"); + + let guest_client = localhost_client(); + let err = guest_client + .get_published_collab_blob(&my_namespace, my_doc_name) + .await + .err() + .unwrap(); + assert_eq!(format!("{:?}", err.code), "RecordNotFound"); + } } async fn get_first_workspace_string(c: &client_api::Client) -> String { @@ -130,3 +148,8 @@ async fn get_first_workspace_string(c: &client_api::Client) -> String { .workspace_id .to_string() } + +#[derive(serde::Serialize, serde::Deserialize)] +struct Metadata { + title: String, +}