MCPcopy Create free account
hub / github.com/ZingerLittleBee/ServerBee / insert_test_server

Function insert_test_server

crates/server/src/task/alert_evaluator.rs:68–88  ·  view source on GitHub ↗
(db: &sea_orm::DatabaseConnection, id: &str, name: &str)

Source from the content-addressed store, hash-verified

66 }
67
68 async fn insert_test_server(db: &sea_orm::DatabaseConnection, id: &str, name: &str) {
69 let token_hash = AuthService::hash_password("test").expect("hash_password should succeed");
70 // Deterministic timestamp; the tick performs no Now()-based assertion.
71 let now = Utc.with_ymd_and_hms(2026, 1, 1, 0, 0, 0).unwrap();
72 server::ActiveModel {
73 id: Set(id.to_string()),
74 token_hash: Set(Some(token_hash)),
75 token_prefix: Set(Some("serverbee_test".to_string())),
76 name: Set(name.to_string()),
77 weight: Set(0),
78 hidden: Set(false),
79 capabilities: Set(CAP_DEFAULT as i32),
80 protocol_version: Set(1),
81 created_at: Set(now),
82 updated_at: Set(now),
83 ..Default::default()
84 }
85 .insert(db)
86 .await
87 .expect("insert test server should succeed");
88 }
89
90 async fn insert_alert_rule(
91 db: &sea_orm::DatabaseConnection,

Calls 1

defaultFunction · 0.85

Tested by

no test coverage detected