new helper function to generate channel parametesr for generating chanels
This commit is contained in:
parent
e46ea5080d
commit
296fde9954
@ -17,3 +17,22 @@ pub fn hyper_resp() -> hyper::Response<hyper::Body> {
|
||||
Response::new(Body::empty())
|
||||
}
|
||||
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
pub async fn tmp_channel_params(p: &mysql_async::Pool, chan_name: &'static str) -> crate::channels::Channel {
|
||||
use crate::channels::{Channel, ChannelType};
|
||||
use mysql_async::{params, prelude::Queryable};
|
||||
|
||||
let conn = p.get_conn().await.unwrap();
|
||||
let _ = conn.prep_exec(
|
||||
"INSERT INTO channels (name, description, kind) VALUES (:name, :description, :kind)",
|
||||
params!{"name" => chan_name, "kind" => 0, "description" => "no description for testing"}).await;
|
||||
|
||||
Channel {
|
||||
id: 0,
|
||||
name: chan_name.into(),
|
||||
kind: ChannelType::Text,
|
||||
description: "no description for testing".into()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user