mirror of
https://github.com/langgenius/dify.git
synced 2026-07-19 16:44:00 -04:00
[autofix.ci] apply automated fixes
(cherry picked from commit 9231ec7c54)
This commit is contained in:
committed by
Yansong Zhang
parent
96e6e9d879
commit
bbf06bbef2
@@ -778,9 +778,7 @@ class TestBillingServiceQuotaOperations:
|
||||
def test_quota_release_with_bucket(self, mock_send_request):
|
||||
mock_send_request.return_value = {"available": 100, "reserved": 0, "released": 1}
|
||||
|
||||
BillingService.quota_release(
|
||||
tenant_id="t1", feature_key="credit_pool", reservation_id="rid-1", bucket="trial"
|
||||
)
|
||||
BillingService.quota_release(tenant_id="t1", feature_key="credit_pool", reservation_id="rid-1", bucket="trial")
|
||||
|
||||
call_json = mock_send_request.call_args[1]["json"]
|
||||
assert call_json["bucket"] == "trial"
|
||||
|
||||
@@ -365,8 +365,9 @@ def test_check_and_deduct_credits_logs_when_billing_release_fails() -> None:
|
||||
patch("services.credit_pool_service.dify_config.BILLING_ENABLED", True),
|
||||
patch("services.billing_service.BillingService.quota_reserve") as quota_reserve,
|
||||
patch("services.billing_service.BillingService.quota_commit", side_effect=RuntimeError("commit failed")),
|
||||
patch("services.billing_service.BillingService.quota_release", side_effect=RuntimeError("release failed"))
|
||||
as quota_release,
|
||||
patch(
|
||||
"services.billing_service.BillingService.quota_release", side_effect=RuntimeError("release failed")
|
||||
) as quota_release,
|
||||
patch("services.credit_pool_service.logger.warning") as logger_warning,
|
||||
):
|
||||
quota_reserve.return_value = {"reservation_id": "reservation-1", "available": 7, "reserved": 3}
|
||||
|
||||
Reference in New Issue
Block a user