| 355 | use serverbee_common::constants::CAP_DEFAULT; |
| 356 | |
| 357 | async fn insert_test_server(db: &DatabaseConnection, id: &str, name: &str) { |
| 358 | let token_hash = AuthService::hash_password("test").expect("hash_password should succeed"); |
| 359 | let now = Utc::now(); |
| 360 | server::ActiveModel { |
| 361 | id: Set(id.to_string()), |
| 362 | token_hash: Set(Some(token_hash)), |
| 363 | token_prefix: Set(Some("serverbee_test".to_string())), |
| 364 | name: Set(name.to_string()), |
| 365 | weight: Set(0), |
| 366 | hidden: Set(false), |
| 367 | capabilities: Set(CAP_DEFAULT as i32), |
| 368 | protocol_version: Set(1), |
| 369 | created_at: Set(now), |
| 370 | updated_at: Set(now), |
| 371 | ..Default::default() |
| 372 | } |
| 373 | .insert(db) |
| 374 | .await |
| 375 | .expect("insert test server should succeed"); |
| 376 | } |
| 377 | |
| 378 | fn update_input() -> UpdateServerInput { |
| 379 | UpdateServerInput { |