Separate direct talk power moderation from pending queue grants
This commit is contained in:
1 parent
c80219b1a3
commit
0b4a707637
12 files changed
+423
-106
No files matched your search
@@ -317,6 +317,22 @@ fn connect_and_disconnect_validate_arguments_before_network_io() {
|
||||
core.shutdown();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn talk_power_validates_its_captured_target_before_dispatch() {
|
||||
let dir = TempDir::new("talk-power-args");
|
||||
let mut core = Core::start(&dir.0);
|
||||
let valid = json!({"generation":9_007_199_254_740_991u64,"client_id":65535,"uid":"peer=","grant":false});
|
||||
for (field,value) in [("generation",json!(0)),("generation",json!(9_007_199_254_740_992u64)),
|
||||
("client_id",json!(0)),("client_id",json!(65536)),("uid",json!("")),("grant",json!(1)),("unexpected",json!(true))] {
|
||||
let mut args = valid.clone(); args[field] = value;
|
||||
let (reply,_) = core.request("invalid", "talk_power", args);
|
||||
assert_eq!(reply["error"]["code"], "bad_request", "{field}: {reply}");
|
||||
}
|
||||
let (reply,_) = core.request("valid", "talk_power", valid);
|
||||
assert_eq!(reply["error"]["code"], "not_connected", "{reply}");
|
||||
core.shutdown();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn status_messages_are_optional_but_must_be_valid_when_present() {
|
||||
let dir=TempDir::new("status-message-args");
|
||||
|
||||
Reference in new issue
Block a user