-
Notifications
You must be signed in to change notification settings - Fork 28
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
198f23e
commit fd0f925
Showing
7 changed files
with
97 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1228,6 +1228,46 @@ def test_update_email_address(self, modify_customer_mock, retrieve_mock): | |
self.current_owner.stripe_customer_id, email=new_email | ||
) | ||
|
||
@patch("services.billing.stripe.Subscription.retrieve") | ||
@patch("services.billing.stripe.Customer.modify") | ||
@patch("services.billing.stripe.PaymentMethod.modify") | ||
@patch("services.billing.stripe.Customer.retrieve") | ||
def test_update_email_address_with_propagate( | ||
self, | ||
customer_retrieve_mock, | ||
payment_method_mock, | ||
modify_customer_mock, | ||
retrieve_mock, | ||
): | ||
self.current_owner.stripe_customer_id = "flsoe" | ||
self.current_owner.stripe_subscription_id = "djfos" | ||
self.current_owner.save() | ||
|
||
payment_method_id = "pm_123" | ||
customer_retrieve_mock.return_value = { | ||
"invoice_settings": {"default_payment_method": payment_method_id} | ||
} | ||
|
||
new_email = "[email protected]" | ||
kwargs = { | ||
"service": self.current_owner.service, | ||
"owner_username": self.current_owner.username, | ||
} | ||
data = {"new_email": new_email, "should_propagate_to_payment_methods": True} | ||
url = reverse("account_details-update-email", kwargs=kwargs) | ||
response = self.client.patch(url, data=data, format="json") | ||
assert response.status_code == status.HTTP_200_OK | ||
|
||
modify_customer_mock.assert_called_once_with( | ||
self.current_owner.stripe_customer_id, email=new_email | ||
) | ||
customer_retrieve_mock.assert_called_once_with( | ||
self.current_owner.stripe_customer_id | ||
) | ||
payment_method_mock.assert_called_once_with( | ||
payment_method_id, billing_details={"email": new_email} | ||
) | ||
|
||
def test_update_billing_address_without_body(self): | ||
kwargs = { | ||
"service": self.current_owner.service, | ||
|
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
2 changes: 1 addition & 1 deletion
2
graphql_api/types/mutation/create_stripe_setup_intent/create_stripe_setup_intent.graphql
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