-
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b46685
commit 1f83a15
Showing
9 changed files
with
108 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use std::collections::HashMap; | ||
|
||
use stripe_product::price::{UpdatePrice, UpdatePriceCurrencyOptions}; | ||
use stripe_types::price::PriceTaxBehavior; | ||
use stripe_types::Currency; | ||
|
||
use crate::mock; | ||
|
||
#[test] | ||
// https://github.com/arlyon/async-stripe/issues/417 | ||
fn update_price() { | ||
mock::with_client(|client| { | ||
let mut update = UpdatePrice::new(); | ||
let mut currency_opts = HashMap::new(); | ||
let mut opt = UpdatePriceCurrencyOptions::new(); | ||
opt.unit_amount = Some(4); | ||
currency_opts.insert(Currency::USD, opt); | ||
update.currency_options = Some(¤cy_opts); | ||
|
||
let price_id = "price_123".parse().unwrap(); | ||
|
||
let price = update.send(client, &price_id).unwrap(); | ||
assert_eq!(price.id, price_id); | ||
assert_eq!(price.tax_behavior, Some(PriceTaxBehavior::Unspecified)); | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use stripe_product::product::{CreateProduct, CreateProductFeatures}; | ||
|
||
use crate::mock; | ||
|
||
#[test] | ||
// FIXME: stripe-mock is missing required `type` field | ||
#[ignore] | ||
// https://github.com/arlyon/async-stripe/issues/437 | ||
fn create_product() { | ||
mock::with_client(|client| { | ||
let mut create = CreateProduct::new("my product"); | ||
let features = vec![CreateProductFeatures::new("great feature")]; | ||
create.features = Some(&features); | ||
|
||
let product = create.send(client).unwrap(); | ||
assert_eq!(product.features.first().unwrap().name, Some("great feature".into())); | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use stripe_product::promotion_code::CreatePromotionCode; | ||
|
||
use crate::mock; | ||
|
||
#[test] | ||
// https://github.com/arlyon/async-stripe/issues/389 | ||
fn create_promotion_code() { | ||
mock::with_client(|client| { | ||
let mut create = CreatePromotionCode::new("code"); | ||
create.active = Some(true); | ||
|
||
let result = create.send(client).unwrap(); | ||
assert!(result.active); | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters