Live off-site Postgres copy on 247 replaces the nightly pg_dump; backup retention in deploy.sh
- ops/pgbackup: SSH tunnel + pg_receivewal (slot zareian_247) + daily verified pg_basebackup (keep 7) and a restore check, all run on 78.38.35.247 as systemd units - /api/health reports offsiteBackup (slot active/lag/lost) and warns; OFFSITE_WAL_SLOT setting - removed statuslog backup_db/backup_verify and their health warnings - deploy.sh keeps 3 pre-deploy dumps, 3 local patches, drops manual backups after 30 days - docs: operations backup section, security item 14 closed, CLAUDE.md status Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
26
payment/tests_audit_log.py
Normal file
26
payment/tests_audit_log.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""
|
||||
ردِ نتیجهی درگاه در لاگِ فنی: کالبکِ بیسفارش و نتیجهی تکراری فقط همینجا رد دارند (پولی جابهجا
|
||||
نمیکنند، پس ردیفِ دیتابیس ندارند). نتیجههای پذیرفتهشده در Transaction/StatusChangeLogاند.
|
||||
"""
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
class PaymentAuditLogTests(TestCase):
|
||||
def test_unknown_authority_callback_is_404_and_logged(self):
|
||||
with self.assertLogs('payment.views', level='WARNING') as cm:
|
||||
r = self.client.get('/api/payment/zarinpal/callback?Authority=A000NOPE&Status=OK')
|
||||
self.assertEqual(r.status_code, 404)
|
||||
self.assertIn('no order', cm.output[0])
|
||||
|
||||
def test_ignored_duplicate_paid_result_is_logged_as_warning(self):
|
||||
from payment.models import Order
|
||||
from payment.services import apply_order_payment_result
|
||||
o = Order.objects.create(user_id=1, amount=1000, idempotency_key='k1', gateway_authority='A1')
|
||||
with self.assertLogs('payment.services', level='INFO') as cm:
|
||||
apply_order_payment_result(order=o, gateway='zarinpal', gateway_ref_id='R1',
|
||||
new_status='paid', event='t')
|
||||
self.assertIn('ignored=False', cm.output[0])
|
||||
with self.assertLogs('payment.services', level='INFO') as cm:
|
||||
apply_order_payment_result(order=o, gateway='zarinpal', gateway_ref_id='R1',
|
||||
new_status='paid', event='t')
|
||||
self.assertIn('ignored=True', cm.output[0])
|
||||
Reference in New Issue
Block a user