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

Function insert_test_server

crates/server/src/service/server.rs:357–376  ·  view source on GitHub ↗
(db: &DatabaseConnection, id: &str, name: &str)

Source from the content-addressed store, hash-verified

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 {

Calls 1

defaultFunction · 0.85

Tested by 4

test_list_serversFunction · 0.56
test_get_server_foundFunction · 0.56
test_delete_serverFunction · 0.56
test_batch_deleteFunction · 0.56