-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the organization customer email upon signup
* Only do this is the person signing up is the owner of the org and there isn't already a stripe subscription associated with the org
- Loading branch information
Bianca Yang
committed
Nov 17, 2023
1 parent
b2c5f3f
commit 0f0add0
Showing
7 changed files
with
49 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,26 @@ def test_update_billing_distinct_ids(self, billing_patch_request_mock: MagicMock | |
BillingManager(license).update_billing_distinct_ids(organization) | ||
assert billing_patch_request_mock.call_count == 1 | ||
assert len(billing_patch_request_mock.call_args[1]["json"]["distinct_ids"]) == 2 | ||
|
||
@patch( | ||
"ee.billing.billing_manager.requests.patch", | ||
return_value=MagicMock(status_code=200, json=MagicMock(return_value={"text": "ok"})), | ||
) | ||
def test_update_billing_customer_email(self, billing_patch_request_mock: MagicMock): | ||
organization = self.organization | ||
license = super(LicenseManager, cast(LicenseManager, License.objects)).create( | ||
key="key123::key123", | ||
plan="enterprise", | ||
valid_until=timezone.datetime(2038, 1, 19, 3, 14, 7), | ||
) | ||
User.objects.create_and_join( | ||
organization=organization, | ||
email="[email protected]", | ||
password=None, | ||
level=OrganizationMembership.Level.OWNER, | ||
) | ||
organization.refresh_from_db() | ||
assert len(organization.members.values_list("distinct_id", flat=True)) == 2 # one exists in the test base | ||
BillingManager(license).update_billing_customer_email(organization) | ||
assert billing_patch_request_mock.call_count == 1 | ||
assert billing_patch_request_mock.call_args[1]["json"]["org_owner_email"] == "[email protected]" |
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