comment out tests that talk to the api directly

This commit is contained in:
Edgar 2022-11-09 10:40:25 +01:00
parent 2b0fc27b39
commit 2c4661fd3f
5 changed files with 16 additions and 9 deletions

View file

@ -21,6 +21,7 @@ use paypal_rs::{
api::orders::*, api::orders::*,
data::orders::*, data::orders::*,
data::common::Currency, data::common::Currency,
PaypalEnv,
}; };
#[tokio::main] #[tokio::main]
@ -29,7 +30,7 @@ async fn main() {
let clientid = std::env::var("PAYPAL_CLIENTID").unwrap(); let clientid = std::env::var("PAYPAL_CLIENTID").unwrap();
let secret = std::env::var("PAYPAL_SECRET").unwrap(); let secret = std::env::var("PAYPAL_SECRET").unwrap();
let mut client = Client::new(clientid, secret, true); let mut client = Client::new(clientid, secret, PaypalEnv::Sandbox);
client.get_access_token().await.unwrap(); client.get_access_token().await.unwrap();

View file

@ -389,6 +389,7 @@ impl super::Client {
} }
*/ */
/*
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
@ -433,3 +434,4 @@ mod tests {
Ok(()) Ok(())
} }
} }
*/

View file

@ -185,7 +185,7 @@ impl Endpoint for AuthorizeOrder {
Some(self.body.clone()) Some(self.body.clone())
} }
} }
/*
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::data::common::Currency; use crate::data::common::Currency;
@ -257,3 +257,4 @@ mod tests {
Ok(()) Ok(())
} }
} }
*/

View file

@ -87,8 +87,8 @@ impl Client {
/// ///
/// # Examples /// # Examples
/// ///
/// ``` /// ```no_run
/// use paypal_rs::Client; /// use paypal_rs::{Client, PaypalEnv};
/// ///
/// #[tokio::main] /// #[tokio::main]
/// async fn main() { /// async fn main() {
@ -99,7 +99,7 @@ impl Client {
/// let mut client = Client::new( /// let mut client = Client::new(
/// clientid, /// clientid,
/// secret, /// secret,
/// true, /// PaypalEnv::Sandbox,
/// ); /// );
/// client.get_access_token().await.unwrap(); /// client.get_access_token().await.unwrap();
/// } /// }

View file

@ -14,12 +14,13 @@
//! ## Example //! ## Example
//! //!
//! ```rust //! ```no_run
//! use paypal_rs::{ //! use paypal_rs::{
//! Client, //! Client,
//! api::orders::*, //! api::orders::*,
//! data::orders::*, //! data::orders::*,
//! data::common::Currency, //! data::common::Currency,
//! PaypalEnv,
//! }; //! };
//! //!
//! #[tokio::main] //! #[tokio::main]
@ -28,7 +29,7 @@
//! let clientid = std::env::var("PAYPAL_CLIENTID").unwrap(); //! let clientid = std::env::var("PAYPAL_CLIENTID").unwrap();
//! let secret = std::env::var("PAYPAL_SECRET").unwrap(); //! let secret = std::env::var("PAYPAL_SECRET").unwrap();
//! //!
//! let mut client = Client::new(clientid, secret, true); //! let mut client = Client::new(clientid, secret, PaypalEnv::Sandbox);
//! //!
//! client.get_access_token().await.unwrap(); //! client.get_access_token().await.unwrap();
//! //!
@ -175,10 +176,11 @@ struct AuthAssertionClaims {
mod tests { mod tests {
use crate::countries::Country; use crate::countries::Country;
use crate::data::common::Currency; use crate::data::common::Currency;
use crate::Client; //use crate::Client;
use std::env; //use std::env;
use std::str::FromStr; use std::str::FromStr;
/*
pub async fn create_client() -> Client { pub async fn create_client() -> Client {
dotenvy::dotenv().ok(); dotenvy::dotenv().ok();
let clientid = env::var("PAYPAL_CLIENTID").unwrap(); let clientid = env::var("PAYPAL_CLIENTID").unwrap();
@ -186,6 +188,7 @@ mod tests {
Client::new(clientid, secret, crate::PaypalEnv::Sandbox) Client::new(clientid, secret, crate::PaypalEnv::Sandbox)
} }
*/
#[test] #[test]
fn test_currency() { fn test_currency() {