Remove test_
prefix from lots of test functions
This commit is contained in:
parent
64b9c646d1
commit
3b3ef1cb75
@ -142,7 +142,7 @@ mod tests {
|
||||
use crate::r0::filter::{LazyLoadOptions, RoomEventFilter};
|
||||
|
||||
#[test]
|
||||
fn test_serialize_some_room_event_filter() {
|
||||
fn serialize_some_room_event_filter() {
|
||||
let room_id = room_id!("!roomid:example.org");
|
||||
let rooms = &[room_id.clone()];
|
||||
let filter = RoomEventFilter {
|
||||
@ -176,7 +176,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialize_none_room_event_filter() {
|
||||
fn serialize_none_room_event_filter() {
|
||||
let room_id = room_id!("!roomid:example.org");
|
||||
let req = Request {
|
||||
room_id: &room_id,
|
||||
@ -193,7 +193,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialize_default_room_event_filter() {
|
||||
fn serialize_default_room_event_filter() {
|
||||
let room_id = room_id!("!roomid:example.org");
|
||||
let req = Request {
|
||||
room_id: &room_id,
|
||||
|
@ -57,7 +57,7 @@ mod tests {
|
||||
use super::Response;
|
||||
|
||||
#[test]
|
||||
fn test_serializing_get_tags_response() {
|
||||
fn serializing_get_tags_response() {
|
||||
let mut tags = Tags::new();
|
||||
tags.insert("m.favourite".into(), assign!(TagInfo::new(), { order: Some(0.25) }));
|
||||
tags.insert("u.user_tag".into(), assign!(TagInfo::new(), { order: Some(0.11) }));
|
||||
|
@ -150,7 +150,7 @@ mod tests {
|
||||
use crate::error::{ErrorBody, ErrorKind};
|
||||
|
||||
#[test]
|
||||
fn test_serialize_authentication_data_direct_request() {
|
||||
fn serialize_authentication_data_direct_request() {
|
||||
let authentication_data = AuthData::DirectRequest {
|
||||
kind: "example.type.foo",
|
||||
session: Some("ZXY000"),
|
||||
@ -170,7 +170,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_authentication_data_direct_request() {
|
||||
fn deserialize_authentication_data_direct_request() {
|
||||
let json = json!({
|
||||
"type": "example.type.foo",
|
||||
"session": "opaque_session_id",
|
||||
@ -189,14 +189,14 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialize_authentication_data_fallback() {
|
||||
fn serialize_authentication_data_fallback() {
|
||||
let authentication_data = AuthData::FallbackAcknowledgement { session: "ZXY000" };
|
||||
|
||||
assert_eq!(json!({ "session": "ZXY000" }), to_json_value(authentication_data).unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_authentication_data_fallback() {
|
||||
fn deserialize_authentication_data_fallback() {
|
||||
let json = json!({ "session": "opaque_session_id" });
|
||||
|
||||
assert_matches!(
|
||||
@ -207,7 +207,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialize_uiaa_info() {
|
||||
fn serialize_uiaa_info() {
|
||||
let uiaa_info = UiaaInfo {
|
||||
flows: vec![AuthFlow {
|
||||
stages: vec!["m.login.password".into(), "m.login.dummy".into()],
|
||||
@ -236,7 +236,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_uiaa_info() {
|
||||
fn deserialize_uiaa_info() {
|
||||
let json = json!({
|
||||
"errcode": "M_FORBIDDEN",
|
||||
"error": "Invalid password",
|
||||
@ -294,7 +294,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_try_uiaa_response_into_http_response() {
|
||||
fn try_uiaa_response_into_http_response() {
|
||||
let uiaa_info = UiaaInfo {
|
||||
flows: vec![AuthFlow {
|
||||
stages: vec!["m.login.password".into(), "m.login.dummy".into()],
|
||||
@ -333,7 +333,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_try_uiaa_response_from_http_response() {
|
||||
fn try_uiaa_response_from_http_response() {
|
||||
let json = serde_json::to_string(&json!({
|
||||
"errcode": "M_FORBIDDEN",
|
||||
"error": "Invalid password",
|
||||
|
@ -224,13 +224,13 @@ mod tests {
|
||||
use super::{IncomingRoomNetwork, RoomNetwork};
|
||||
|
||||
#[test]
|
||||
fn test_serialize_matrix_network_only() {
|
||||
fn serialize_matrix_network_only() {
|
||||
let json = json!({});
|
||||
assert_eq!(to_json_value(RoomNetwork::Matrix).unwrap(), json);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_matrix_network_only() {
|
||||
fn deserialize_matrix_network_only() {
|
||||
let json = json!({ "include_all_networks": false });
|
||||
assert_eq!(
|
||||
from_json_value::<IncomingRoomNetwork>(json).unwrap(),
|
||||
@ -239,13 +239,13 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialize_default_network_is_empty() {
|
||||
fn serialize_default_network_is_empty() {
|
||||
let json = json!({});
|
||||
assert_eq!(to_json_value(RoomNetwork::default()).unwrap(), json);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_empty_network_is_default() {
|
||||
fn deserialize_empty_network_is_default() {
|
||||
let json = json!({});
|
||||
assert_eq!(
|
||||
from_json_value::<IncomingRoomNetwork>(json).unwrap(),
|
||||
@ -254,25 +254,25 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialize_include_all_networks() {
|
||||
fn serialize_include_all_networks() {
|
||||
let json = json!({ "include_all_networks": true });
|
||||
assert_eq!(to_json_value(RoomNetwork::All).unwrap(), json);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_include_all_networks() {
|
||||
fn deserialize_include_all_networks() {
|
||||
let json = json!({ "include_all_networks": true });
|
||||
assert_eq!(from_json_value::<IncomingRoomNetwork>(json).unwrap(), IncomingRoomNetwork::All);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialize_third_party_network() {
|
||||
fn serialize_third_party_network() {
|
||||
let json = json!({ "third_party_instance_id": "freenode" });
|
||||
assert_eq!(to_json_value(RoomNetwork::ThirdParty("freenode")).unwrap(), json);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_third_party_network() {
|
||||
fn deserialize_third_party_network() {
|
||||
let json = json!({ "third_party_instance_id": "freenode" });
|
||||
assert_eq!(
|
||||
from_json_value::<IncomingRoomNetwork>(json).unwrap(),
|
||||
@ -281,7 +281,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_include_all_networks_and_third_party_exclusivity() {
|
||||
fn deserialize_include_all_networks_and_third_party_exclusivity() {
|
||||
let json = json!({ "include_all_networks": true, "third_party_instance_id": "freenode" });
|
||||
assert_eq!(
|
||||
from_json_value::<IncomingRoomNetwork>(json).unwrap_err().to_string().as_str(),
|
||||
|
@ -352,7 +352,7 @@ fn serialize_pdu_as_v3() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_pdu_as_v1() {
|
||||
fn deserialize_pdu_as_v1() {
|
||||
let json = json!({
|
||||
"room_id": "!n8f893n9:example.com",
|
||||
"event_id": "$somejoinevent:matrix.org",
|
||||
|
@ -77,7 +77,7 @@ mod tests {
|
||||
use crate::membership::create_join_event::RoomState;
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_response() {
|
||||
fn deserialize_response() {
|
||||
let response = json!([
|
||||
200,
|
||||
{
|
||||
@ -99,7 +99,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialize_response() {
|
||||
fn serialize_response() {
|
||||
let room_state =
|
||||
RoomState { origin: "matrix.org".into(), auth_chain: Vec::new(), state: Vec::new() };
|
||||
|
||||
@ -120,7 +120,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_too_short_array() {
|
||||
fn too_short_array() {
|
||||
let json = json!([200]);
|
||||
let failed_room_state = deserialize::<RoomState, _>(json);
|
||||
assert_eq!(
|
||||
@ -130,7 +130,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_not_an_array() {
|
||||
fn not_an_array() {
|
||||
let json = json!({
|
||||
"origin": "matrix.org",
|
||||
"auth_chain": [],
|
||||
@ -145,7 +145,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_too_long_array() {
|
||||
fn too_long_array() {
|
||||
let json = json!([200, {"origin": "", "auth_chain": [], "state": []}, 200]);
|
||||
assert_matches!(
|
||||
deserialize(json).unwrap(),
|
||||
|
@ -54,7 +54,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_some() {
|
||||
fn deserialize_some() {
|
||||
let json = json!({ "timeout": 3000 });
|
||||
|
||||
assert_eq!(
|
||||
@ -64,7 +64,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_none_by_absence() {
|
||||
fn deserialize_none_by_absence() {
|
||||
let json = json!({});
|
||||
|
||||
assert_eq!(
|
||||
@ -74,7 +74,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_none_by_null() {
|
||||
fn deserialize_none_by_null() {
|
||||
let json = json!({ "timeout": null });
|
||||
|
||||
assert_eq!(
|
||||
@ -84,13 +84,13 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialize_some() {
|
||||
fn serialize_some() {
|
||||
let request = DurationTest { timeout: Some(Duration::new(2, 0)) };
|
||||
assert_eq!(serde_json::to_value(&request).unwrap(), json!({ "timeout": 2000 }));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialize_none() {
|
||||
fn serialize_none() {
|
||||
let request = DurationTest { timeout: None };
|
||||
assert_eq!(serde_json::to_value(&request).unwrap(), json!({}));
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize() {
|
||||
fn deserialize() {
|
||||
let json = json!({ "timeout": 3 });
|
||||
|
||||
assert_eq!(
|
||||
@ -60,7 +60,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialize() {
|
||||
fn serialize() {
|
||||
let test = DurationTest { timeout: Duration::from_millis(7000) };
|
||||
assert_eq!(serde_json::to_value(test).unwrap(), json!({ "timeout": 7 }));
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize() {
|
||||
fn deserialize() {
|
||||
let json = json!({ "timestamp": 3000 });
|
||||
|
||||
assert_eq!(
|
||||
@ -64,7 +64,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialize() {
|
||||
fn serialize() {
|
||||
let request = SystemTimeTest { timestamp: UNIX_EPOCH + Duration::new(2, 0) };
|
||||
assert_eq!(serde_json::to_value(&request).unwrap(), json!({ "timestamp": 2000 }));
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_some() {
|
||||
fn deserialize_some() {
|
||||
let json = json!({ "timestamp": 3000 });
|
||||
|
||||
assert_eq!(
|
||||
@ -60,7 +60,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_none_by_absence() {
|
||||
fn deserialize_none_by_absence() {
|
||||
let json = json!({});
|
||||
|
||||
assert_eq!(
|
||||
@ -70,7 +70,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_none_by_null() {
|
||||
fn deserialize_none_by_null() {
|
||||
let json = json!({ "timestamp": null });
|
||||
|
||||
assert_eq!(
|
||||
@ -80,13 +80,13 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialize_some() {
|
||||
fn serialize_some() {
|
||||
let request = SystemTimeTest { timestamp: Some(UNIX_EPOCH + Duration::new(2, 0)) };
|
||||
assert_eq!(serde_json::to_value(&request).unwrap(), json!({ "timestamp": 2000 }));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialize_none() {
|
||||
fn serialize_none() {
|
||||
let request = SystemTimeTest { timestamp: None };
|
||||
assert_eq!(serde_json::to_value(&request).unwrap(), json!({}));
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_some() {
|
||||
fn deserialize_some() {
|
||||
let json = json!({ "timestamp": 3000 });
|
||||
|
||||
assert_eq!(
|
||||
@ -60,7 +60,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_none_by_absence() {
|
||||
fn deserialize_none_by_absence() {
|
||||
let json = json!({});
|
||||
|
||||
assert_eq!(
|
||||
@ -70,7 +70,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_none_by_null() {
|
||||
fn deserialize_none_by_null() {
|
||||
let json = json!({ "timestamp": null });
|
||||
|
||||
assert_eq!(
|
||||
@ -80,13 +80,13 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialize_some() {
|
||||
fn serialize_some() {
|
||||
let request = SystemTimeTest { timestamp: Some(UNIX_EPOCH + Duration::new(2000, 0)) };
|
||||
assert_eq!(serde_json::to_value(&request).unwrap(), json!({ "timestamp": 2000 }));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialize_none() {
|
||||
fn serialize_none() {
|
||||
let request = SystemTimeTest { timestamp: None };
|
||||
assert_eq!(serde_json::to_value(&request).unwrap(), json!({}));
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize() {
|
||||
fn deserialize() {
|
||||
let json = json!({ "timestamp": 3000 });
|
||||
|
||||
assert_eq!(
|
||||
@ -64,7 +64,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialize() {
|
||||
fn serialize() {
|
||||
let request = SystemTimeTest { timestamp: UNIX_EPOCH + Duration::new(2000, 0) };
|
||||
assert_eq!(serde_json::to_value(&request).unwrap(), json!({ "timestamp": 2000 }));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user