adding 400 case for send_message test - all tests passing as expected
This commit is contained in:
parent
afb965f4e8
commit
e6273b437b
@ -75,3 +75,31 @@ pub async fn send_message(pool: &Pool, response: &mut Response<Body>, params: Va
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod messaging_tests {
|
||||||
|
use crate::testing::{get_pool, hyper_resp};
|
||||||
|
use serde_json::Value;
|
||||||
|
use hyper::StatusCode;
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn send_message_test_missing_channel() {
|
||||||
|
/*
|
||||||
|
* Attempt to send a message i na channel that does not exist
|
||||||
|
*/
|
||||||
|
let p = get_pool();
|
||||||
|
let mut resp = hyper_resp();
|
||||||
|
|
||||||
|
let params: Value = serde_json::from_str(r#"
|
||||||
|
{
|
||||||
|
"channel": "this does not exist",
|
||||||
|
"content": "bs message",
|
||||||
|
"id": 420
|
||||||
|
}
|
||||||
|
"#).unwrap();
|
||||||
|
|
||||||
|
super::send_message(&p, &mut resp, params).await;
|
||||||
|
|
||||||
|
assert_ne!(StatusCode::OK, resp.status());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user