-
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.
feat: Update the organization customer email upon signup (#18724)
* 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 * undo local changes that shouldn't be in prod * small tweaks to match backend * fix test * Update query snapshots * Update query snapshots --------- Co-authored-by: Bianca Yang <[email protected]> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
a5e2ca1
commit ecd5256
Showing
5 changed files
with
47 additions
and
13 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 |
---|---|---|
|
@@ -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_customer_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