Moved upload_photo to an example

This commit is contained in:
Aaron Power
2018-06-29 11:17:36 +01:00
parent 523d83022e
commit 53f403d99d
4 changed files with 12 additions and 33 deletions
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

-32
View File
@@ -1,32 +0,0 @@
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(())
}