@@ -343,19 +343,36 @@ def test_create_payment_link(self):
343
343
344
344
self .assertEqual (result , mock_payment_link )
345
345
346
- def test_create_payment_link_with_context (self ):
346
+ def test_create_payment_link_with_redirect_url (self ):
347
347
with mock .patch ("stripe.PaymentLink.create" ) as mock_function :
348
348
mock_payment_link = {"id" : "pl_123" , "url" : "https://example.com" }
349
349
mock_function .return_value = stripe .PaymentLink .construct_from (
350
350
mock_payment_link , "sk_test_123"
351
351
)
352
352
353
353
result = create_payment_link (
354
- context = {"account" : "acct_123" }, price = "price_123" , quantity = 1 , redirect_url = "https://example.com"
354
+ context = {}, price = "price_123" , quantity = 1 , redirect_url = "https://example.com"
355
355
)
356
356
357
357
mock_function .assert_called_with (
358
358
line_items = [{"price" : "price_123" , "quantity" : 1 , "after_completion" : {"type" : "redirect" , "redirect" : {"url" : "https://example.com" }}}],
359
+ )
360
+
361
+ self .assertEqual (result , mock_payment_link )
362
+
363
+ def test_create_payment_link_with_context (self ):
364
+ with mock .patch ("stripe.PaymentLink.create" ) as mock_function :
365
+ mock_payment_link = {"id" : "pl_123" , "url" : "https://example.com" }
366
+ mock_function .return_value = stripe .PaymentLink .construct_from (
367
+ mock_payment_link , "sk_test_123"
368
+ )
369
+
370
+ result = create_payment_link (
371
+ context = {"account" : "acct_123" }, price = "price_123" , quantity = 1
372
+ )
373
+
374
+ mock_function .assert_called_with (
375
+ line_items = [{"price" : "price_123" , "quantity" : 1 }],
359
376
stripe_account = "acct_123" ,
360
377
)
361
378
0 commit comments