extern crate mhteams; extern crate reqwest; use mhteams::*; const URL: &str = "https://outlook.office.com/webhook/80dce46d-8741-4560-abc3-57ab11cfd94a@28e5afa2-bf6f-419a-8cf6-b31c6e9e5e8d/IncomingWebhook/06f68c90d9e3499abba7ad0ab5c6412b/d6c084b4-61ce-46f7-8edc-48fab014115a"; #[test] fn teams() { let msg = Message::new() .title("My NEW teams title 😉") .text("TL;DR: don't bother 👍") .theme_color("ffffff") .sections(vec![ Section::new() .title("Første seksjon 😃") .text("Bla bla, ikke en veldig interresant seksjon..."), Section::new() .title("En seksjon med bilder? 📷") .images(vec![(Image::new("Blåbærbilde", "https://scontent.fosl1-1.fna.fbcdn.net/v/t1.0-9/30703765_10216161821946812_1668385285991301120_n.jpg?_nc_cat=100&_nc_sid=09cbfe&_nc_ohc=oNxngcqkyXcAX_WA3qu&_nc_ht=scontent.fosl1-1.fna&oh=9fc8f2327e6a80d42ba18ae431d04638&oe=5F18A131"))]), Section::new() .title("En seksjon med aktivitet(er)") .activity_title("Min *aktivitetstittel* 🏃") .activity_subtitle("_Ei litta test_") .activity_image("https://upload.wikimedia.org/wikipedia/commons/thumb/7/7e/Circle-icons-profile.svg/1200px-Circle-icons-profile.svg.png") .activity_text("Noe skjer, blablabla... Lorum ipsum!") .hero_image(Image::new("A rocket!", "https://pi.tedcdn.com/r/talkstar-assets.s3.amazonaws.com/production/playlists/playlist_492/rocket_science_1200x627.jpg?quality=89&w=800")), Section::new() .title("Andre sek! La oss sjekke ✅") .facts(vec![ Fact::new("Navn", "MHmorgan "), Fact::new("Favorittprogrammeringsspråk", "Dumt spørsmål. Uten tvil, Rust"), ]), ]); let client = reqwest::blocking::Client::new(); let resp = client .post(URL) .json(&msg) .send() .expect("sending post request"); assert!(resp.error_for_status().is_ok()); }