From 9c39a9703f9519bbce95e8764e8f088557f2ea25 Mon Sep 17 00:00:00 2001 From: Samir Boulahtit Date: Wed, 11 Mar 2026 23:47:51 +0100 Subject: [PATCH] fix(tenancy): mock billing limit check in store creation unit test The test was failing because can_create_store() called the billing module's check_resource_limit() which returned False for the test merchant (no subscription). Patched the limit check since billing is not what this unit test exercises. Co-Authored-By: Claude Opus 4.6 --- app/modules/tenancy/tests/unit/test_merchant_store_service.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/modules/tenancy/tests/unit/test_merchant_store_service.py b/app/modules/tenancy/tests/unit/test_merchant_store_service.py index dfa7f0ec..daf869e8 100644 --- a/app/modules/tenancy/tests/unit/test_merchant_store_service.py +++ b/app/modules/tenancy/tests/unit/test_merchant_store_service.py @@ -2,6 +2,7 @@ """Unit tests for MerchantStoreService.""" import uuid +from unittest.mock import patch import pytest @@ -172,7 +173,8 @@ class TestMerchantStoreServiceCreate: def setup_method(self): self.service = MerchantStoreService() - def test_create_store_success(self, db, merchant_owner): + @patch.object(MerchantStoreService, "can_create_store", return_value=(True, None)) + def test_create_store_success(self, _mock_limit, db, merchant_owner): """Test successful store creation.""" unique_id = str(uuid.uuid4())[:8] store_data = {