mastodon API rust lib elefren, fixed and updated. and also all ASYNC! NB. most examples are now wrong.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
elefren-fork/tests/upload_photo.rs

33 lines
729 B

extern crate mammut;
extern crate dotenv;
use std::env;
use mammut::{Data, Mastodon};
use dotenv::dotenv;
// Do not run this test by default because it requires a real Mastodon
// connection setup.
#[test]
#[ignore]
fn upload_photo() {
dotenv().ok();
run().unwrap();
}
fn run() -> mammut::Result<()> {
let data = Data {
base: env::var("BASE").unwrap().into(),
client_id: env::var("CLIENT_ID").unwrap().into(),
client_secret: env::var("CLIENT_SECRET").unwrap().into(),
redirect: env::var("REDIRECT").unwrap().into(),
token: env::var("TOKEN").unwrap().into(),
};
let mastodon = Mastodon::from_data(data);
mastodon.media("tests/test.png".into())?;
Ok(())
}