@@ -35,6 +35,17 @@ class WC_Payment_Gateway {}
3535ok_auth ( '401 diagnostic is specific ' , 'unauthorized ' === $ diagnostic ['code ' ] && false !== strpos ( $ diagnostic ['msg ' ], 'credentials ' ) );
3636$ diagnostic = WC_Gateway_Monero::node_setup_diagnostic ( array ( 'code ' => 'digest_unavailable ' ) );
3737ok_auth ( 'Digest diagnostic requests cURL ' , 'digest_unavailable ' === $ diagnostic ['code ' ] && false !== strpos ( $ diagnostic ['msg ' ], 'cURL ' ) );
38+ ok_auth ( 'one healthy node tolerates an unreachable fallback ' , WC_Gateway_Monero::node_health_allows_payments ( array (
39+ array ( 'ok ' => true , 'nettype ' => 'stagenet ' ),
40+ array ( 'ok ' => false , 'nettype ' => 'unknown ' ),
41+ ), 'stagenet ' ) );
42+ ok_auth ( 'reachable wrong-network node is rejected ' , ! WC_Gateway_Monero::node_health_allows_payments ( array (
43+ array ( 'ok ' => true , 'nettype ' => 'stagenet ' ),
44+ array ( 'ok ' => true , 'nettype ' => 'mainnet ' ),
45+ ), 'stagenet ' ) );
46+ ok_auth ( 'no healthy node fails closed ' , ! WC_Gateway_Monero::node_health_allows_payments ( array (
47+ array ( 'ok ' => false , 'nettype ' => 'unknown ' ),
48+ ), 'stagenet ' ) );
3849
3950$ responses [] = array ( 'code ' => 200 , 'body ' => json_encode ( array ( 'height ' => 123 , 'nettype ' => 'mainnet ' ) ) );
4051$ scanner = new Monero_Scanner ( array ( array ( 'url ' => 'https://node.test ' , 'auth ' => 'basic ' , 'username ' => 'u ' , 'password ' => 'p ' ) ) );
0 commit comments