aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2020-01-04 13:15:00 +0100
committerHarald Eilertsen <haraldei@anduin.net>2020-01-04 13:15:00 +0100
commit1ba083af3576d20b5c1fc1c6ebacefd91ceb6636 (patch)
tree54a04c60fcd6721ab5c0cb782f1fc2bef38538b7 /tests
parent862a3b67d701b3c124e1b682db0cee5fc5b711da (diff)
downloadrust-zotapi-1ba083af3576d20b5c1fc1c6ebacefd91ceb6636.tar.gz
rust-zotapi-1ba083af3576d20b5c1fc1c6ebacefd91ceb6636.tar.bz2
rust-zotapi-1ba083af3576d20b5c1fc1c6ebacefd91ceb6636.zip
abconfig: reorg + parse result into struct.
Diffstat (limited to 'tests')
-rw-r--r--tests/zotapi.rs33
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]