Add `with_permission_config` to `Network`
Add a `permission_config` field to the `Network` struct in the testing
framework. This field is set by calling `with_permission_config` when
creating the network. the `with_permission_config` method takes a vec
of `PermissionConfig` structs and passes it to the
`with_permission_config` method on `NodeBuilder`.
@@ -21,7 +21,9 @@ use cylinder::{secp256k1::Secp256k1Context, Context};
use splinter::error::{InternalError, InvalidArgumentError};
use splinter::registry::Node as RegistryNode;
use splinter::threading::lifecycle::ShutdownHandle;
-use splinterd::node::{Node, NodeBuilder, RestApiVariant, RunnableNode, ScabbardConfigBuilder};
+use splinterd::node::{
+ Node, NodeBuilder, PermissionConfig, RestApiVariant, RunnableNode, ScabbardConfigBuilder,
+};
use tempdir::TempDir;
use super::circuit_builder::CircuitBuilder;
@@ -33,6 +35,7 @@ pub struct Network {
external_registries: Option<Vec<String>>,
num_of_keys: usize,
cylinder_auth: bool,
+ permission_config: Option<Vec<PermissionConfig>>,
}
pub enum NetworkNode {
@@ -49,6 +52,7 @@ impl Network {
external_registries: None,
num_of_keys: 1,
cylinder_auth: true,
+ permission_config: None,
}
}
@@ -158,6 +162,11 @@ impl Network {
self
}
+ pub fn with_permission_config(mut self, permission_config: Vec<PermissionConfig>) -> Self {
+ self.permission_config = Some(permission_config);
+ self
+ }
+
pub fn node(&self, n: usize) -> Result<&Node, InvalidArgumentError> {
match self.nodes.get(n) {
Some(network_node) => match network_node {
