diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/zotapi.rs | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/tests/zotapi.rs b/tests/zotapi.rs index 1621af1..70a9564 100644 --- a/tests/zotapi.rs +++ b/tests/zotapi.rs @@ -240,9 +240,38 @@ fn fetch_connections() { #[test] fn fetch_abconfig() { - let m = default_mock("GET", "/api/z/1.0/abconfig"); - let _res = zotapi::abconfig().fetch(&client()).unwrap(); + let data = r#" + [ + { + "id": 666, + "chan": 42, + "xchan": "xchanhash1", + "cat": "some_other_cat", + "k": "key1", + "v": "value1" + }, + { + "id": 667, + "chan": 44, + "xchan": "xchanhash2", + "cat": "some_cat", + "k": "key2", + "v": "value2" + } + + ]"#; + + let m = mock_with_authorization("GET", "/api/z/1.0/abconfig") + .with_status(200) + .with_body(&data) + .create(); + + let res = zotapi::abconfig::fetch(&client()).unwrap(); m.assert(); + + assert_eq!(res.len(), 2); + assert_eq!(res[0].id, 666); + assert_eq!(res[1].k, "key2"); } #[test] |