Add local document resource commands
This commit is contained in:
parent
527090fd4c
commit
ce260625d6
14 changed files with 277 additions and 14 deletions
|
|
@ -551,6 +551,64 @@ fn kv_create_set_get_use_local_store() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn document_create_and_status_use_local_store() {
|
||||
let home = tempfile::tempdir().expect("tempdir");
|
||||
let paths = geth_config::GethPaths::from_home(home.path());
|
||||
let node = geth_node::init_node(&paths).expect("init node");
|
||||
|
||||
let response = geth_node::handle_request(
|
||||
&node,
|
||||
geth_control::ControlRequest::DocumentCreate {
|
||||
name: "notes".to_owned(),
|
||||
},
|
||||
)
|
||||
.expect("create document");
|
||||
match response {
|
||||
geth_control::ControlResponse::DocumentCreated { document } => {
|
||||
assert_eq!(document.name, "notes");
|
||||
assert_eq!(document.sync_status, "local-only");
|
||||
assert_eq!(document.state_bytes, 2);
|
||||
}
|
||||
other => panic!("unexpected response: {other:?}"),
|
||||
}
|
||||
|
||||
let response = geth_node::handle_request(
|
||||
&node,
|
||||
geth_control::ControlRequest::DocumentStatus {
|
||||
name: "notes".to_owned(),
|
||||
},
|
||||
)
|
||||
.expect("document status");
|
||||
match response {
|
||||
geth_control::ControlResponse::DocumentStatus { document } => {
|
||||
assert_eq!(document.id.to_string(), "document:notes");
|
||||
assert_eq!(document.resource.to_string(), "resource:document:notes");
|
||||
assert_eq!(document.state_bytes, 2);
|
||||
}
|
||||
other => panic!("unexpected response: {other:?}"),
|
||||
}
|
||||
|
||||
assert!(
|
||||
geth_node::handle_request(
|
||||
&node,
|
||||
geth_control::ControlRequest::DocumentCreate {
|
||||
name: "../bad".to_owned(),
|
||||
},
|
||||
)
|
||||
.is_err()
|
||||
);
|
||||
assert!(
|
||||
geth_node::handle_request(
|
||||
&node,
|
||||
geth_control::ControlRequest::DocumentStatus {
|
||||
name: "missing".to_owned(),
|
||||
},
|
||||
)
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ssh_cert_request_approval_and_revocation_export_use_local_state() {
|
||||
let home = tempfile::tempdir().expect("tempdir");
|
||||
|
|
|
|||
Loading…
Reference in a new issue