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

29 lines
627 B

extern crate mammut;
extern crate dotenv;
use std::env;
use mammut::{Data, Mastodon};
use dotenv::dotenv;
#[test]
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(())
}