dj-stripe / dj-stripe

dj-stripe automatically syncs your Stripe Data to your local database as pre-implemented Django Models allowing you to use the Django ORM, in your code, to work with the data making it easier and faster.
https://dj-stripe.dev
MIT License
1.56k stars 474 forks source link

🔥 Django Admin URLs found many Internal Server Errors (500) while testing using django-smoke-tests #2036

Open agusmakmun opened 1 month ago

agusmakmun commented 1 month ago

Describe the bug Django Admin URLs of dj-stripe found many Internal Server Errors (500) while testing using django-smoke-tests. It can be GET, PUT, POST, or DELETE. If the URL is not valid, should not return any Internal Server Errors.

This will lead alert fatigues when someone randomly hit the dj-stripe urls in django admin. Especially for anonymous user.

To Reproduce

  1. Install the dj-stripe package (any version).
  2. Install django-smoke-tests: pip install django-smoke-tests
  3. Add the "django_smoke_tests" to the INSTALLED_APPS.
  4. Then run the command python manage.py smoke_tests --allow-status-codes=200,201,204,301,302,304,400,401,403,405,415

Software versions

Temporary Solution

Right now I'm using the SKIP_SMOKE_TESTS to add any URLs that has errors. But, that's not good approach because of dj-stripe have many models, also I need to deep debug which urls that need to be added.

For example:

SKIP_SMOKE_TESTS = (
    # 3d party: djstripe
    "djstripe_custom_action",
    # 3d party: djstripe.idempotencykey
    # /admin/djstripe/idempotencykey/
    "admin:djstripe_idempotencykey_changelist",
    "admin:djstripe_idempotencykey_add",
    "admin:djstripe_idempotencykey_history",
    "admin:djstripe_idempotencykey_delete",
    "admin:djstripe_idempotencykey_change",
    # 3d party: djstripe.webhookeventtrigger
    # /admin/djstripe/webhookeventtrigger/
    "admin:djstripe_webhookeventtrigger_changelist",
    "admin:djstripe_webhookeventtrigger_add",
    "admin:djstripe_webhookeventtrigger_history",
    "admin:djstripe_webhookeventtrigger_delete",
    "admin:djstripe_webhookeventtrigger_change",
    # 3d party: djstripe.account
    # /admin/djstripe/account/
    "admin:djstripe_account_changelist",
    "admin:djstripe_account_add",
    "admin:djstripe_account_history",
    "admin:djstripe_account_delete",
    "admin:djstripe_account_change",
    # 3d party: djstripe.apikey
    # /admin/djstripe/apikey/
    "admin:djstripe_apikey_changelist",
    "admin:djstripe_apikey_add",
    "admin:djstripe_apikey_history",
    "admin:djstripe_apikey_delete",
    "admin:djstripe_apikey_change",
    # 3d party: djstripe.balancetransaction
    # /admin/djstripe/balancetransaction/
    "admin:djstripe_balancetransaction_changelist",
    "admin:djstripe_balancetransaction_add",
    "admin:djstripe_balancetransaction_history",
    "admin:djstripe_balancetransaction_delete",
    "admin:djstripe_balancetransaction_change",
    # 3d party: djstripe.bankaccount
    # /admin/djstripe/bankaccount/
    "admin:djstripe_bankaccount_changelist",
    "admin:djstripe_bankaccount_add",
    "admin:djstripe_bankaccount_history",
    "admin:djstripe_bankaccount_delete",
    "admin:djstripe_bankaccount_change",
    # 3d party: djstripe.card
    # /admin/djstripe/card/
    "admin:djstripe_card_changelist",
    "admin:djstripe_card_add",
    "admin:djstripe_card_history",
    "admin:djstripe_card_delete",
    "admin:djstripe_card_change",
    # 3d party: djstripe.charge
    # /admin/djstripe/charge/
    "admin:djstripe_charge_changelist",
    "admin:djstripe_charge_add",
    "admin:djstripe_charge_history",
    "admin:djstripe_charge_delete",
    "admin:djstripe_charge_change",
    # 3d party: djstripe.coupon
    # /admin/djstripe/coupon/
    "admin:djstripe_coupon_changelist",
    "admin:djstripe_coupon_add",
    "admin:djstripe_coupon_history",
    "admin:djstripe_coupon_delete",
    "admin:djstripe_coupon_change",
    # 3d party: djstripe.customer
    # /admin/djstripe/customer/
    "admin:djstripe_customer_changelist",
    "admin:djstripe_customer_add",
    "admin:djstripe_customer_history",
    "admin:djstripe_customer_delete",
    "admin:djstripe_customer_change",
    # 3d party: djstripe.dispute
    # /admin/djstripe/dispute/
    "admin:djstripe_dispute_changelist",
    "admin:djstripe_dispute_add",
    "admin:djstripe_dispute_history",
    "admin:djstripe_dispute_delete",
    "admin:djstripe_dispute_change",
    # 3d party: djstripe.event
    # /admin/djstripe/event/
    "admin:djstripe_event_changelist",
    "admin:djstripe_event_add",
    "admin:djstripe_event_history",
    "admin:djstripe_event_delete",
    "admin:djstripe_event_change",
    # 3d party: djstripe.fileupload
    # /admin/djstripe/fileupload/
    "admin:djstripe_fileupload_changelist",
    "admin:djstripe_fileupload_add",
    "admin:djstripe_fileupload_history",
    "admin:djstripe_fileupload_delete",
    "admin:djstripe_fileupload_change",
    # 3d party: djstripe.file
    # /admin/djstripe/file/
    "admin:djstripe_file_changelist",
    "admin:djstripe_file_add",
    "admin:djstripe_file_history",
    "admin:djstripe_file_delete",
    "admin:djstripe_file_change",
    # 3d party: djstripe.paymentintent
    # /admin/djstripe/paymentintent/
    "admin:djstripe_paymentintent_changelist",
    "admin:djstripe_paymentintent_add",
    "admin:djstripe_paymentintent_history",
    "admin:djstripe_paymentintent_delete",
    "admin:djstripe_paymentintent_change",
    # 3d party: djstripe.setupintent
    # /admin/djstripe/setupintent/
    "admin:djstripe_setupintent_changelist",
    "admin:djstripe_setupintent_add",
    "admin:djstripe_setupintent_history",
    "admin:djstripe_setupintent_delete",
    "admin:djstripe_setupintent_change",
    # 3d party: djstripe.invoice
    # /admin/djstripe/invoice/
    "admin:djstripe_invoice_changelist",
    "admin:djstripe_invoice_add",
    "admin:djstripe_invoice_history",
    "admin:djstripe_invoice_delete",
    "admin:djstripe_invoice_change",
    # 3d party: djstripe.plan
    # /admin/djstripe/plan/
    "admin:djstripe_plan_changelist",
    "admin:djstripe_plan_add",
    "admin:djstripe_plan_history",
    "admin:djstripe_plan_delete",
    "admin:djstripe_plan_change",
    # 3d party: djstripe.price
    # /admin/djstripe/price/
    "admin:djstripe_price_changelist",
    "admin:djstripe_price_add",
    "admin:djstripe_price_history",
    "admin:djstripe_price_delete",
    "admin:djstripe_price_change",
    # 3d party: djstripe.product
    # /admin/djstripe/product/
    "admin:djstripe_product_changelist",
    "admin:djstripe_product_add",
    "admin:djstripe_product_history",
    "admin:djstripe_product_delete",
    "admin:djstripe_product_change",
    # 3d party: djstripe.refund
    # /admin/djstripe/refund/
    "admin:djstripe_refund_changelist",
    "admin:djstripe_refund_add",
    "admin:djstripe_refund_history",
    "admin:djstripe_refund_delete",
    "admin:djstripe_refund_change",
    # 3d party: djstripe.source
    # /admin/djstripe/source/
    "admin:djstripe_source_changelist",
    "admin:djstripe_source_add",
    "admin:djstripe_source_history",
    "admin:djstripe_source_delete",
    "admin:djstripe_source_change",
    # 3d party: djstripe.paymentmethod
    # /admin/djstripe/paymentmethod/
    "admin:djstripe_paymentmethod_changelist",
    "admin:djstripe_paymentmethod_add",
    "admin:djstripe_paymentmethod_history",
    "admin:djstripe_paymentmethod_delete",
    "admin:djstripe_paymentmethod_change",
    # 3d party: djstripe.subscription
    # /admin/djstripe/subscription/
    "admin:djstripe_subscription_changelist",
    "admin:djstripe_subscription_add",
    "admin:djstripe_subscription_history",
    "admin:djstripe_subscription_delete",
    "admin:djstripe_subscription_change",
    # 3d party: djstripe.taxrate
    # /admin/djstripe/taxrate/
    "admin:djstripe_taxrate_changelist",
    "admin:djstripe_taxrate_add",
    "admin:djstripe_taxrate_history",
    "admin:djstripe_taxrate_delete",
    "admin:djstripe_taxrate_change",
    # 3d party: djstripe.transfer
    # /admin/djstripe/transfer/
    "admin:djstripe_transfer_changelist",
    "admin:djstripe_transfer_add",
    "admin:djstripe_transfer_history",
    "admin:djstripe_transfer_delete",
    "admin:djstripe_transfer_change",
    # 3d party: djstripe.transferreversal
    # /admin/djstripe/transferreversal/
    "admin:djstripe_transferreversal_changelist",
    "admin:djstripe_transferreversal_add",
    "admin:djstripe_transferreversal_history",
    "admin:djstripe_transferreversal_delete",
    "admin:djstripe_transferreversal_change",
    # 3d party: djstripe.usagerecordsummary
    # /admin/djstripe/usagerecordsummary/
    "admin:djstripe_usagerecordsummary_changelist",
    "admin:djstripe_usagerecordsummary_add",
    "admin:djstripe_usagerecordsummary_history",
    "admin:djstripe_usagerecordsummary_delete",
    "admin:djstripe_usagerecordsummary_change",
    # 3d party: djstripe.webhookendpoint
    # /admin/djstripe/webhookendpoint/
    "admin:djstripe_webhookendpoint_changelist",
    "admin:djstripe_webhookendpoint_add",
    "admin:djstripe_webhookendpoint_history",
    "admin:djstripe_webhookendpoint_delete",
    "admin:djstripe_webhookendpoint_change",
    # 3d party: djstripe.subscriptionschedule
    # /admin/djstripe/subscriptionschedule/
    "admin:djstripe_subscriptionschedule_changelist",
    "admin:djstripe_subscriptionschedule_add",
    "admin:djstripe_subscriptionschedule_history",
    "admin:djstripe_subscriptionschedule_delete",
    "admin:djstripe_subscriptionschedule_change",
    # 3d party: djstripe.shippingrate
    # /admin/djstripe/shippingrate/
    "admin:djstripe_shippingrate_changelist",
    "admin:djstripe_shippingrate_add",
    "admin:djstripe_shippingrate_history",
    "admin:djstripe_shippingrate_delete",
    "admin:djstripe_shippingrate_change",
    # 3d party: djstripe.session
    # /admin/djstripe/session/
    "admin:djstripe_session_changelist",
    "admin:djstripe_session_add",
    "admin:djstripe_session_history",
    "admin:djstripe_session_delete",
    "admin:djstripe_session_change",
    # 3d party: djstripe.payout
    # /admin/djstripe/payout/
    "admin:djstripe_payout_changelist",
    "admin:djstripe_payout_add",
    "admin:djstripe_payout_history",
    "admin:djstripe_payout_delete",
    "admin:djstripe_payout_change",
    # 3d party: djstripe.order
    # /admin/djstripe/order/
    "admin:djstripe_order_changelist",
    "admin:djstripe_order_add",
    "admin:djstripe_order_history",
    "admin:djstripe_order_delete",
    "admin:djstripe_order_change",
    # 3d party: djstripe.mandate
    # /admin/djstripe/mandate/
    "admin:djstripe_mandate_changelist",
    "admin:djstripe_mandate_add",
    "admin:djstripe_mandate_history",
    "admin:djstripe_mandate_delete",
    "admin:djstripe_mandate_change",
    # 3d party: djstripe.filelink
    # /admin/djstripe/filelink/
    "admin:djstripe_filelink_changelist",
    "admin:djstripe_filelink_add",
    "admin:djstripe_filelink_history",
    "admin:djstripe_filelink_delete",
    "admin:djstripe_filelink_change",
    # 3d party: djstripe.applicationfeerefund
    # /admin/djstripe/applicationfeerefund/
    "admin:djstripe_applicationfeerefund_changelist",
    "admin:djstripe_applicationfeerefund_add",
    "admin:djstripe_applicationfeerefund_history",
    "admin:djstripe_applicationfeerefund_delete",
    "admin:djstripe_applicationfeerefund_change",
    # 3d party: djstripe.applicationfee
    # /admin/djstripe/applicationfee/
    "admin:djstripe_applicationfee_changelist",
    "admin:djstripe_applicationfee_add",
    "admin:djstripe_applicationfee_history",
    "admin:djstripe_applicationfee_delete",
    "admin:djstripe_applicationfee_change",
)