This repository was archived by the owner on Jun 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1696,6 +1696,32 @@ def test_create_checkout_session_with_stripe_customer_id(
16961696 customer_update = {"name" : "auto" , "address" : "auto" },
16971697 )
16981698
1699+ @patch ("logging.Logger.error" )
1700+ @patch ("services.billing.stripe.checkout.Session.create" )
1701+ def test_create_checkout_session_with_invalid_plan (
1702+ self , create_checkout_session_mock , logger_error_mock
1703+ ):
1704+ stripe_customer_id = "test-cusa78723hb4@"
1705+ owner = OwnerFactory (
1706+ service = Service .GITHUB .value ,
1707+ stripe_customer_id = stripe_customer_id ,
1708+ )
1709+ desired_quantity = 25
1710+ desired_plan = {
1711+ "value" : "invalid_plan" ,
1712+ "quantity" : desired_quantity ,
1713+ }
1714+
1715+ self .stripe .create_checkout_session (owner , desired_plan )
1716+
1717+ create_checkout_session_mock .assert_not_called ()
1718+ logger_error_mock .assert_called_once_with (
1719+ f"Plan { desired_plan ['value' ]} not found" ,
1720+ extra = dict (
1721+ owner_id = owner .ownerid ,
1722+ ),
1723+ )
1724+
16991725 def test_get_subscription_when_no_subscription (self ):
17001726 owner = OwnerFactory (stripe_subscription_id = None )
17011727 assert self .stripe .get_subscription (owner ) is None
You can’t perform that action at this time.
0 commit comments