-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathgraph_error.rs
24 lines (22 loc) · 888 Bytes
/
graph_error.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use graph_rs_sdk::error::ErrorMessage;
use reqwest::StatusCode;
use test_tools::oauth_request::ASYNC_THROTTLE_MUTEX;
use test_tools::oauth_request::{Environment, OAuthTestClient};
#[tokio::test]
async fn drive_download_graph_error() {
if Environment::is_local() {
let _lock = ASYNC_THROTTLE_MUTEX.lock().await;
if let Some((id, client)) = OAuthTestClient::ClientCredentials.graph_async().await {
let response = client
.drive(id.as_str())
.item_by_path(":/non_existent_file.docx:")
.get_items_content()
.send()
.await
.unwrap();
assert_eq!(response.status(), StatusCode::NOT_FOUND);
let error: ErrorMessage = response.json().await.unwrap();
assert_eq!(Some("itemNotFound".into()), error.code_property());
}
}
}