mirror of
https://codeberg.org/demostf/api-client.git
synced 2026-06-03 08:34:15 +02:00
incompatible updates for 0.5
This commit is contained in:
parent
216ae4540e
commit
d2fee4d3eb
4 changed files with 413 additions and 953 deletions
|
|
@ -11,6 +11,10 @@ fn test_demo_path() -> String {
|
|||
std::env::var("TEST_DEMO").unwrap_or_else(|_| "./tests/data/gully.dem".to_string())
|
||||
}
|
||||
|
||||
fn id(id: u64) -> SteamID {
|
||||
SteamID::from_steam64(id).unwrap()
|
||||
}
|
||||
|
||||
async fn setup() {
|
||||
let _ = tracing_subscriber::fmt()
|
||||
.with_env_filter(EnvFilter::from_default_env())
|
||||
|
|
@ -141,7 +145,7 @@ async fn test_list_demos() {
|
|||
assert!(demos[0].uploader.user().is_none());
|
||||
assert_eq!(
|
||||
demos[0].uploader.resolve(&client).await.unwrap().steam_id,
|
||||
SteamID::from(76561198024494988)
|
||||
id(76561198024494988)
|
||||
);
|
||||
|
||||
assert_eq!(demos[0].player_count, 12);
|
||||
|
|
@ -160,11 +164,11 @@ async fn test_get_demo() {
|
|||
assert!(demo.uploader.user().is_some());
|
||||
assert_eq!(
|
||||
demo.uploader.user().unwrap().steam_id,
|
||||
SteamID::from(76561198024494988)
|
||||
id(76561198024494988)
|
||||
);
|
||||
assert_eq!(
|
||||
demo.uploader.resolve(&client).await.unwrap().steam_id,
|
||||
SteamID::from(76561198024494988)
|
||||
id(76561198024494988)
|
||||
);
|
||||
|
||||
let mut players = demo.players.unwrap();
|
||||
|
|
@ -175,7 +179,7 @@ async fn test_get_demo() {
|
|||
.cmp(&b.user.steam_id.account_id())
|
||||
});
|
||||
|
||||
assert_eq!(players[0].user.steam_id, SteamID::from(76561198010628997));
|
||||
assert_eq!(players[0].user.steam_id, id(76561198010628997));
|
||||
assert_eq!(players[0].user.name, "freak u ___");
|
||||
}
|
||||
|
||||
|
|
@ -297,7 +301,7 @@ async fn test_list_upload() {
|
|||
|
||||
let demos = client
|
||||
.list_uploads(
|
||||
SteamID::from(76561198024494987),
|
||||
id(76561198024494987),
|
||||
ListParams::default().with_order(ListOrder::Ascending),
|
||||
1,
|
||||
)
|
||||
|
|
@ -307,7 +311,7 @@ async fn test_list_upload() {
|
|||
|
||||
let demos = client
|
||||
.list_uploads(
|
||||
SteamID::from(76561198024494988),
|
||||
id(76561198024494988),
|
||||
ListParams::default().with_order(ListOrder::Ascending),
|
||||
1,
|
||||
)
|
||||
|
|
@ -350,7 +354,7 @@ async fn test_search_players() {
|
|||
|
||||
let user = client.search_users("freak").await.unwrap();
|
||||
assert_eq!(user.len(), 1);
|
||||
assert_eq!(user[0].steam_id, SteamID::from(76561198010628997));
|
||||
assert_eq!(user[0].steam_id, id(76561198010628997));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue