-
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.
marketplace: make sure customer id from api is returned as an int (PR…
…OJQUAY-233) (quay#2590) * make sure customer id from api is returned as an int
- Loading branch information
Showing
3 changed files
with
16 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -119,7 +119,7 @@ def test_user_lookup(self, requests_mock): | |
requests_mock.return_value.content = json.dumps(mocked_user_service_response) | ||
|
||
customer_id = user_api.lookup_customer_id("[email protected]") | ||
assert customer_id == "000000000" | ||
assert customer_id == 000000000 | ||
|
||
requests_mock.return_value.content = json.dumps(mocked_organization_only_response) | ||
customer_id = user_api.lookup_customer_id("[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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,3 +60,15 @@ def test_reconcile_different_ids(initialized_db): | |
mock.return_value = None | ||
worker._perform_reconciliation(marketplace_users, marketplace_subscriptions) | ||
assert model.entitlements.get_web_customer_id(test_user.id) is None | ||
|
||
|
||
def test_update_same_id(initialized_db): | ||
test_user = model.user.create_user("stripe_user", "password", "[email protected]") | ||
test_user.stripe_id = "cus_" + "".join(random.choices(string.ascii_lowercase, k=14)) | ||
test_user.save() | ||
model.entitlements.save_web_customer_id(test_user, 11111) | ||
|
||
with patch.object(model.entitlements, "update_web_customer_id") as mock: | ||
worker._perform_reconciliation(marketplace_users, marketplace_subscriptions) | ||
|
||
mock.assert_not_called() |