(db: &DatabaseConnection, id: &str)
| 82 | use serverbee_common::constants::CAP_DEFAULT; |
| 83 | |
| 84 | async fn insert_test_server(db: &DatabaseConnection, id: &str) { |
| 85 | let token_hash = AuthService::hash_password("test").expect("hash_password should succeed"); |
| 86 | let now = Utc::now(); |
| 87 | server::ActiveModel { |
| 88 | id: Set(id.to_string()), |
| 89 | token_hash: Set(Some(token_hash)), |
| 90 | token_prefix: Set(Some("serverbee_test".to_string())), |
| 91 | name: Set(id.to_string()), |
| 92 | weight: Set(0), |
| 93 | hidden: Set(false), |
| 94 | capabilities: Set(CAP_DEFAULT as i32), |
| 95 | protocol_version: Set(1), |
| 96 | created_at: Set(now), |
| 97 | updated_at: Set(now), |
| 98 | ..Default::default() |
| 99 | } |
| 100 | .insert(db) |
| 101 | .await |
| 102 | .expect("insert test server should succeed"); |
| 103 | } |
| 104 | |
| 105 | /// Insert a raw record at the given time with a fixed cpu value so the |
| 106 | /// hourly average is deterministic. |
no test coverage detected