appservice-api: Remove PartialEq impl for Namespace
This commit is contained in:
		
							parent
							
								
									6805f67d75
								
							
						
					
					
						commit
						1db07a2022
					
				| @ -1,5 +1,9 @@ | ||||
| # [unreleased] | ||||
| 
 | ||||
| Breaking changes: | ||||
| 
 | ||||
| * Remove `PartialEq` implementation for `Namespace` | ||||
| 
 | ||||
| # 0.6.0 | ||||
| 
 | ||||
| Breaking changes: | ||||
|  | ||||
| @ -16,7 +16,7 @@ pub mod thirdparty; | ||||
| /// A namespace defined by an application service.
 | ||||
| ///
 | ||||
| /// Used for [appservice registration](https://spec.matrix.org/v1.2/application-service-api/#registration).
 | ||||
| #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | ||||
| #[derive(Clone, Debug, Serialize, Deserialize)] | ||||
| #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] | ||||
| pub struct Namespace { | ||||
|     /// Whether this application service has exclusive access to events within this namespace.
 | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| use matches::assert_matches; | ||||
| use ruma_appservice_api::{Namespace, Namespaces, Registration}; | ||||
| use ruma_appservice_api::Registration; | ||||
| 
 | ||||
| #[test] | ||||
| fn registration_deserialization() { | ||||
| @ -18,31 +18,29 @@ fn registration_deserialization() { | ||||
|               regex: "#_irc_bridge_.*" | ||||
|           rooms: [] | ||||
|         "##;
 | ||||
|     let observed = serde_yaml::from_str(registration_config).unwrap(); | ||||
|     assert_matches!( | ||||
|         observed, | ||||
|         Registration { | ||||
|             id, | ||||
|             url, | ||||
|             as_token, | ||||
|             hs_token, | ||||
|             sender_localpart, | ||||
|             rate_limited, | ||||
|             protocols, | ||||
|             namespaces: Namespaces { users, aliases, rooms, .. }, | ||||
|             .. | ||||
|         } | ||||
|         if id == "IRC Bridge" | ||||
|             && url == "http://127.0.0.1:1234" | ||||
|             && as_token == "30c05ae90a248a4188e620216fa72e349803310ec83e2a77b34fe90be6081f46" | ||||
|             && hs_token == "312df522183efd404ec1cd22d2ffa4bbc76a8c1ccf541dd692eef281356bb74e" | ||||
|             && sender_localpart == "_irc_bot" | ||||
|             && rate_limited == None | ||||
|             && protocols == None | ||||
|             && users[0] == Namespace::new(true, "@_irc_bridge_.*".into()) | ||||
|             && aliases[0] == Namespace::new(false, "#_irc_bridge_.*".into()) | ||||
|             && rooms.is_empty() | ||||
|     let observed: Registration = serde_yaml::from_str(registration_config).unwrap(); | ||||
| 
 | ||||
|     assert_eq!(observed.id, "IRC Bridge"); | ||||
|     assert_eq!(observed.url, "http://127.0.0.1:1234"); | ||||
|     assert_eq!( | ||||
|         observed.as_token, | ||||
|         "30c05ae90a248a4188e620216fa72e349803310ec83e2a77b34fe90be6081f46" | ||||
|     ); | ||||
|     assert_eq!( | ||||
|         observed.hs_token, | ||||
|         "312df522183efd404ec1cd22d2ffa4bbc76a8c1ccf541dd692eef281356bb74e" | ||||
|     ); | ||||
|     assert_eq!(observed.sender_localpart, "_irc_bot"); | ||||
|     assert_eq!(observed.rate_limited, None); | ||||
|     assert_eq!(observed.protocols, None); | ||||
| 
 | ||||
|     assert!(observed.namespaces.users[0].exclusive); | ||||
|     assert_eq!(observed.namespaces.users[0].regex, "@_irc_bridge_.*"); | ||||
| 
 | ||||
|     assert!(!observed.namespaces.aliases[0].exclusive); | ||||
|     assert_eq!(observed.namespaces.aliases[0].regex, "#_irc_bridge_.*"); | ||||
| 
 | ||||
|     assert!(observed.namespaces.rooms.is_empty()); | ||||
| } | ||||
| 
 | ||||
| #[test] | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user