use aur_rs::{Request, ReturnData}; use httpmock::prelude::*; mod common; #[tokio::test] async fn search_package() { let kit = common::setup(); let search_mock = kit.mock_server.mock(|when, then| { when.method(GET).path("/rpc/v5/search/yay-bin"); then.status(200).body(kit.valid_search_json.clone()); }); let url = kit.mock_server.url("/rpc/v5"); let request = Request { endpoint: url.to_string(), }; let response: ReturnData = request.search_package_by_name("yay-bin").await.unwrap(); search_mock.assert(); assert_eq!(response.results[0].name, "yay-bin"); }