summaryrefslogtreecommitdiff
path: root/src/tests.rs
diff options
context:
space:
mode:
authorjakka <jakka@jakka.su>2025-09-17 21:25:08 +0300
committerjakka <jakka@jakka.su>2025-09-17 21:25:08 +0300
commita5f74e05d49ad938c3f0854dc9b1d203a570a8d9 (patch)
tree76251488c9c05c6319999ef50f21a0ccd2fbf18a /src/tests.rs
parentd07a6af4563c0fde224aa630fb2d9feec01579f2 (diff)
moved to async http client and serde
Diffstat (limited to 'src/tests.rs')
-rw-r--r--src/tests.rs48
1 files changed, 4 insertions, 44 deletions
diff --git a/src/tests.rs b/src/tests.rs
index 19d60cf..0ce410e 100644
--- a/src/tests.rs
+++ b/src/tests.rs
@@ -1,50 +1,10 @@
use crate::client::HydrusClient;
use crate::types::*;
-#[test]
-fn correct_hydruspermissions_url_encode() {
- let perms: [HydrusPermissions; 3] = [
- HydrusPermissions::ImportAndEditURLs,
- HydrusPermissions::ImportAndEditFiles,
- HydrusPermissions::SeeLocalPaths,
- ];
- let json_string = musli::json::to_string(&perms).unwrap();
- let encoded = urlencoding::encode(&json_string);
-
- assert_eq!(encoded, "%5B0%2C1%2C13%5D")
-}
-
-#[test]
-fn correct_hydruspermissions_decode() {
- let perms: [HydrusPermissions; 3] = [
- HydrusPermissions::ImportAndEditURLs,
- HydrusPermissions::ImportAndEditFiles,
- HydrusPermissions::SeeLocalPaths,
- ];
- let json_string = musli::json::to_string(&perms).unwrap();
-
- let res: [HydrusPermissions; 3] = musli::json::from_str(&json_string).unwrap();
- assert_eq!(res, perms)
-}
-
-#[test]
-fn correct_hydrusservice_decode() {
- let input: [ServiceType; 3] = [
- ServiceType::AllLocalFiles,
- ServiceType::ClientAPI,
- ServiceType::Trash,
- ];
-
- let json_string = musli::json::to_string(&input).unwrap();
-
- let res: [ServiceType; 3] = musli::json::from_str(&json_string).unwrap();
- assert_eq!(res, input)
-}
-
-#[test]
-fn correct_hydrusservices_decode() {
+#[tokio::test]
+async fn test_service_info() {
let mut client: HydrusClient = HydrusClient::new("http://127.0.0.1:51251/");
client.set_api_key("7ab7accf6cf12b2c6c30436cd8fe16361aee33679dbd90da279b5c22b33d622a");
- let test = client.get_services().unwrap();
- assert!(!test.is_empty())
+ let res = client.get_service_name("all my files").await.unwrap();
+ println!("{:?}", res);
}