TheMovieDB 0.1.0

A robust and idiomatic Rust API wrapper for The Movie Database (TMDb) v3 API.
Documentation
mod utils;
use TheMovieDB::search::Search;
use std::collections::HashMap;

#[tokio::test]
async fn test_search_company() {
    unsafe { std::env::set_var("TMDB_API_KEY", "dummy_api_key"); }
    let search = Search::new();
    let mut options = HashMap::new();
    options.insert("query".to_string(), "disney".to_string());
    let result = search.company(Some(options)).await;
    assert!(result.is_err());
    unsafe { std::env::remove_var("TMDB_API_KEY"); }
}

#[tokio::test]
async fn test_search_collection() {
    unsafe { std::env::set_var("TMDB_API_KEY", "dummy_api_key"); }
    let search = Search::new();
    let mut options = HashMap::new();
    options.insert("query".to_string(), "the lord of the rings".to_string());
    let result = search.collection(Some(options)).await;
    assert!(result.is_err());
    unsafe { std::env::remove_var("TMDB_API_KEY"); }
}

#[tokio::test]
async fn test_search_keyword() {
    unsafe { std::env::set_var("TMDB_API_KEY", "dummy_api_key"); }
    let search = Search::new();
    let mut options = HashMap::new();
    options.insert("query".to_string(), "action".to_string());
    let result = search.keyword(Some(options)).await;
    assert!(result.is_err());
    unsafe { std::env::remove_var("TMDB_API_KEY"); }
}

#[tokio::test]
async fn test_search_movie() {
    unsafe { std::env::set_var("TMDB_API_KEY", "dummy_api_key"); }
    let search = Search::new();
    let mut options = HashMap::new();
    options.insert("query".to_string(), "the lord of the rings".to_string());
    let result = search.movie(Some(options)).await;
    assert!(result.is_err());
    unsafe { std::env::remove_var("TMDB_API_KEY"); }
}

#[tokio::test]
async fn test_search_multi() {
    unsafe { std::env::set_var("TMDB_API_KEY", "dummy_api_key"); }
    let search = Search::new();
    let mut options = HashMap::new();
    options.insert("query".to_string(), "the lord of the rings".to_string());
    let result = search.multi(Some(options)).await;
    assert!(result.is_err());
    unsafe { std::env::remove_var("TMDB_API_KEY"); }
}

#[tokio::test]
async fn test_search_person() {
    unsafe { std::env::set_var("TMDB_API_KEY", "dummy_api_key"); }
    let search = Search::new();
    let mut options = HashMap::new();
    options.insert("query".to_string(), "ian mckellen".to_string());
    let result = search.person(Some(options)).await;
    assert!(result.is_err());
    unsafe { std::env::remove_var("TMDB_API_KEY"); }
}

#[tokio::test]
async fn test_search_tv() {
    unsafe { std::env::set_var("TMDB_API_KEY", "dummy_api_key"); }
    let search = Search::new();
    let mut options = HashMap::new();
    options.insert("query".to_string(), "game of thrones".to_string());
    let result = search.tv(Some(options)).await;
    assert!(result.is_err());
    unsafe { std::env::remove_var("TMDB_API_KEY"); }
}