Moved test::create_channel_good to rust unit tests
This commit is contained in:
@@ -206,6 +206,7 @@ pub async fn delete_channel(pool: &Pool, response: &mut Response<Body>, params:
|
||||
#[cfg(test)]
|
||||
mod channels_tests {
|
||||
use crate::testing::{get_pool, hyper_resp};
|
||||
use serde_json::Value;
|
||||
use hyper::StatusCode;
|
||||
|
||||
#[tokio::test]
|
||||
@@ -220,6 +221,26 @@ mod channels_tests {
|
||||
// Analysis
|
||||
assert_eq!(StatusCode::OK, resp.status());
|
||||
println!("list_all_channels_good : \t{:?}", resp.body());
|
||||
let _ = p.disconnect().await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn create_channel_good() {
|
||||
let p = get_pool();
|
||||
let mut resp = hyper_resp();
|
||||
// @params: name + kind + [description]
|
||||
let params: Value = serde_json::from_str(r#"
|
||||
{
|
||||
"name": "sample channel",
|
||||
"kind": 2,
|
||||
"description": "some random bs"
|
||||
}
|
||||
"#).unwrap();
|
||||
|
||||
super::create_channel(&p, &mut resp, params).await;
|
||||
|
||||
// hopefully we 200
|
||||
assert_eq!(StatusCode::OK, resp.status());
|
||||
let _ = p.disconnect().await;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user