MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_warning

Function test_warning

cln-grpc/src/test.rs:593–618  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

591
592#[test]
593fn test_warning() {
594 let j: serde_json::Value = json!({
595 "level": "warn",
596 "time": "1648222556.498",
597 "timestamp": "2022-03-25T13:57:33.322Z",
598 "source": "lightningd(1234)",
599 "log": "Something unexpected happened"
600 });
601 let u: cln_rpc::notifications::WarningNotification = serde_json::from_value(j).unwrap();
602 assert_eq!(u.level, cln_rpc::notifications::WarningLevel::WARN);
603 assert_eq!(u.source, "lightningd(1234)");
604 assert_serde_roundtrip!(u, cln_rpc::notifications::WarningNotification);
605 let _pb: crate::pb::WarningNotification = u.into();
606
607 // Test error level
608 let j_err: serde_json::Value = json!({
609 "level": "error",
610 "time": "1648222600.000",
611 "timestamp": "2022-03-25T14:00:00.000Z",
612 "source": "channeld(5678)",
613 "log": "Fatal channel error"
614 });
615 let u_err: cln_rpc::notifications::WarningNotification = serde_json::from_value(j_err).unwrap();
616 assert_eq!(u_err.level, cln_rpc::notifications::WarningLevel::ERROR);
617 let _pb_err: crate::pb::WarningNotification = u_err.into();
618}
619
620#[test]
621fn test_pay_part_end() {

Callers

nothing calls this directly

Calls 1

unwrapMethod · 0.45

Tested by

no test coverage detected