WIP: Node role RPC call (#3719)

* Add a Node Role RPC call

* Formatting

* Fix tests

* Change tests to use NodeRole::Authority so I don't forget to update the test

* Improve role checking

* return a vec instead

* fix tests
This commit is contained in:
Ashley
2019-10-16 10:59:25 +01:00
committed by Bastian Köcher
parent 8ef20a5534
commit 642c8504c4
5 changed files with 62 additions and 9 deletions
+11
View File
@@ -79,6 +79,9 @@ fn api<T: Into<Option<Status>>>(sync: T) -> System<Block> {
average_upload_per_sec: 0,
peerset: serde_json::Value::Null,
}).unwrap());
},
Request::NodeRoles(sender) => {
let _ = sender.send(vec![NodeRole::Authority]);
}
};
@@ -221,3 +224,11 @@ fn system_network_state() {
}
);
}
#[test]
fn system_node_roles() {
assert_eq!(
wait_receiver(api(None).system_node_roles()),
vec![NodeRole::Authority]
);
}