Skip to content

Commit

Permalink
Update control_test.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiDrang committed Jan 5, 2025
1 parent 8f9b45c commit 4a4ffe1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/control_test.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::collections::HashMap;

use rust_anticaptcha::control::Control;
use serde_json::json;

use crate::structs::CaptchaArgs;

Expand All @@ -16,7 +15,7 @@ async fn success_get_balance() {
let captcha_args = CaptchaArgs::new();

let control_instance = Control::new();
let result = control_instance.get_balance(captcha_args.API_KEY).await;
let result = control_instance.get_balance(&captcha_args.API_KEY).await;
assert_eq!(result["errorId"], 0);
assert_ne!(result["balance"], 0);
}
Expand All @@ -25,10 +24,11 @@ async fn success_get_balance() {
async fn success_get_app_stats() {
let captcha_args = CaptchaArgs::new();

let mut map = HashMap::new();
map.insert("clientKey".to_string(), captcha_args.API_KEY);
map.insert("softId".to_string(), 1220.to_string());
map.insert("mode".to_string(), "money".to_string());
let map = json!({
"clientKey": captcha_args.API_KEY,
"softId": 1220,
"mode": "money"
});

let control_instance = Control::new();
let result = control_instance.get_app_stats(&map).await;
Expand All @@ -40,7 +40,7 @@ async fn success_get_app_stats() {
#[tokio::test]
async fn fail_get_balance() {
let control_instance = Control::new();
let result = control_instance.get_balance("API_KEY".to_string()).await;
let result = control_instance.get_balance(&"API_KEY".to_string()).await;

assert_eq!(result["errorId"], 1);
assert_eq!(result["errorCode"], "ERROR_KEY_DOES_NOT_EXIST");
Expand Down

0 comments on commit 4a4ffe1

Please sign in to comment.