user search

This commit is contained in:
Robin Appelman 2022-08-21 15:23:24 +02:00
commit a90a20c622
2 changed files with 68 additions and 0 deletions

View file

@ -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;