From: Ian Jackson Date: Wed, 24 Feb 2021 22:22:16 +0000 (+0000) Subject: tests: fetch sse etc. X-Git-Tag: otter-0.4.0~371 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=9d939616c71c19899f630ad189fee8daa5d47f5f;p=otter.git tests: fetch sse etc. Signed-off-by: Ian Jackson --- diff --git a/apitest/at-otter.rs b/apitest/at-otter.rs index 20d2d862..98e5bb55 100644 --- a/apitest/at-otter.rs +++ b/apitest/at-otter.rs @@ -45,6 +45,30 @@ impl Ctx { let body = resp.text()?; let dom = scraper::Html::parse_document(&body); dbg!(&body, &dom); + + let ctoken = dom + .select(&"#main-body".try_into().unwrap()) + .next().unwrap() + .value().attr("data-ctoken") + .unwrap(); + dbg!(&ctoken); + + let gen: Generation = Generation(dom + .select(&"#main-body".try_into().unwrap()) + .next().unwrap() + .value().attr("data-gen") + .unwrap() + .parse().unwrap()); + dbg!(gen); + + let sse = client.get( + &self.ds + .also(&[("ctoken", ctoken), + ("gen", &gen.to_string())]) + .subst("@url@/_/updates?ctoken=@ctoken@&gen=@gen@")? + ).send()?; + + //sse.copy_to(&mut std::io::stderr())?; } }