chore: add client and test for collab workspace deletion
This commit is contained in:
parent
99fc95f33a
commit
146ef9cb8c
|
|
@ -66,11 +66,6 @@ async fn test_set_publish_namespace_set() {
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_publish_doc() {
|
async fn test_publish_doc() {
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
|
||||||
struct Metadata {
|
|
||||||
title: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
let (c, _user) = generate_unique_registered_user_client().await;
|
let (c, _user) = generate_unique_registered_user_client().await;
|
||||||
let workspace_id = get_first_workspace_string(&c).await;
|
let workspace_id = get_first_workspace_string(&c).await;
|
||||||
let my_namespace = uuid::Uuid::new_v4().to_string();
|
let my_namespace = uuid::Uuid::new_v4().to_string();
|
||||||
|
|
@ -118,6 +113,29 @@ async fn test_publish_doc() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(collab_data == "some_collab_data");
|
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::<Metadata>(&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 {
|
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
|
.workspace_id
|
||||||
.to_string()
|
.to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
|
struct Metadata {
|
||||||
|
title: String,
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue