mirror of
https://codeberg.org/demostf/api-client.git
synced 2026-06-03 16:44:09 +02:00
user search
This commit is contained in:
parent
9beb6c3627
commit
a90a20c622
2 changed files with 68 additions and 0 deletions
|
|
@ -59,6 +59,18 @@ async fn setup() {
|
|||
let client = ApiClient::with_base_url(&api_root).unwrap();
|
||||
|
||||
upload(&client, "./tests/data/gully.dem", "test.dem", "R", "B").await;
|
||||
|
||||
let mut transaction = pool.begin().await.unwrap();
|
||||
|
||||
let views = ["map_list", "name_list", "users_named"];
|
||||
for view in views {
|
||||
sqlx::query(&format!("REFRESH MATERIALIZED VIEW {}", view))
|
||||
.execute(&mut transaction)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
transaction.commit().await.unwrap();
|
||||
}
|
||||
|
||||
async fn test_client() -> ApiClient {
|
||||
|
|
@ -328,6 +340,15 @@ async fn test_list_players() {
|
|||
assert_eq!(demos.len(), 0);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_search_players() {
|
||||
let client = test_client().await;
|
||||
|
||||
let user = client.search_users("freak").await.unwrap();
|
||||
assert_eq!(user.len(), 1);
|
||||
assert_eq!(user[0].steam_id, SteamID::from(76561198010628997));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_download_demo() {
|
||||
let client = test_client().await;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue