forked from dj-stripe/dj-stripe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add FAKE_PRODUCT to make tests more realistic
Also add test_stripe_plan_null_product for backwards compatibility Since all the other Plan tests now have a product set
- Loading branch information
1 parent
7842ce6
commit 0580d6f
Showing
15 changed files
with
412 additions
and
195 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
from djstripe.enums import SubscriptionStatus | ||
from djstripe.models import Plan | ||
|
||
from .. import FAKE_CUSTOMER, FAKE_PLAN | ||
from .. import FAKE_CUSTOMER, FAKE_PLAN, FAKE_PRODUCT | ||
|
||
|
||
class SubscriptionSerializerTest(TestCase): | ||
|
@@ -29,7 +29,9 @@ def setUp(self): | |
username="pydanny", email="[email protected]" | ||
) | ||
self.customer = FAKE_CUSTOMER.create_for_user(self.user) | ||
self.plan = Plan.sync_from_stripe_data(deepcopy(FAKE_PLAN)) | ||
|
||
with patch("stripe.Product.retrieve", return_value=deepcopy(FAKE_PRODUCT)): | ||
self.plan = Plan.sync_from_stripe_data(deepcopy(FAKE_PLAN)) | ||
|
||
def test_valid_serializer(self): | ||
now = timezone.now() | ||
|
@@ -63,7 +65,8 @@ def test_valid_serializer(self): | |
) | ||
self.assertEqual(serializer.errors, {}) | ||
|
||
def test_invalid_serializer(self): | ||
@patch("stripe.Product.retrieve", return_value=deepcopy(FAKE_PRODUCT)) | ||
def test_invalid_serializer(self, product_retrieve_mock): | ||
now = timezone.now() | ||
serializer = SubscriptionSerializer( | ||
data={ | ||
|
@@ -83,7 +86,8 @@ def test_invalid_serializer(self): | |
|
||
class CreateSubscriptionSerializerTest(TestCase): | ||
def setUp(self): | ||
self.plan = Plan.sync_from_stripe_data(deepcopy(FAKE_PLAN)) | ||
with patch("stripe.Product.retrieve", return_value=deepcopy(FAKE_PRODUCT)): | ||
self.plan = Plan.sync_from_stripe_data(deepcopy(FAKE_PLAN)) | ||
|
||
@patch("stripe.Token.create", return_value=PropertyMock(id="token_test")) | ||
def test_valid_serializer(self, stripe_token_mock): | ||
|
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
Oops, something went wrong.