Bulk operations REST endpoints (closes #925)
This commit is contained in:
@@ -446,6 +446,47 @@ async fn manage_queue() {
|
||||
}
|
||||
}
|
||||
|
||||
// Bulk cancel
|
||||
assert_eq!(
|
||||
api.request::<List<Message>>(Method::GET, "/api/queue/messages?values=1")
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap_data()
|
||||
.items
|
||||
.len(),
|
||||
3
|
||||
);
|
||||
assert!(api
|
||||
.request::<bool>(Method::DELETE, "/api/queue/messages?text=example2.com")
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap_data());
|
||||
tokio::time::sleep(Duration::from_millis(100)).await;
|
||||
assert_eq!(
|
||||
api.request::<List<QueueId>>(Method::GET, "/api/queue/messages")
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap_data()
|
||||
.items
|
||||
.len(),
|
||||
2
|
||||
);
|
||||
assert!(api
|
||||
.request::<bool>(Method::DELETE, "/api/queue/messages")
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap_data());
|
||||
tokio::time::sleep(Duration::from_millis(100)).await;
|
||||
assert_eq!(
|
||||
api.request::<List<QueueId>>(Method::GET, "/api/queue/messages")
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap_data()
|
||||
.items
|
||||
.len(),
|
||||
0
|
||||
);
|
||||
|
||||
// Test authentication error
|
||||
assert_eq!(
|
||||
reqwest::Client::builder()
|
||||
|
||||
@@ -223,6 +223,22 @@ async fn manage_reports() {
|
||||
assert!(ids.next().unwrap().is_none());
|
||||
assert!(ids.next().unwrap().is_some());
|
||||
assert!(ids.next().unwrap().is_some());
|
||||
|
||||
// Cancel all reports
|
||||
assert!(api
|
||||
.request::<bool>(Method::DELETE, "/api/queue/reports")
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap_data());
|
||||
assert_eq!(
|
||||
api.request::<List<String>>(Method::GET, "/api/queue/reports")
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap_data()
|
||||
.items
|
||||
.len(),
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
impl ManagementApi {
|
||||
|
||||
Reference in New Issue
Block a user