I want to resolve this error and finish the test:
admin.py
def suit_row_attributes(self, obj, request):
"""Add colours to the rows according to the status"""
type_error = 'notSent'
status_colours = {Transaction.STATUS_REJECTED: 'error', Transaction.STATUS_RECEIVED: 'received',
Transaction.STATUS_PENDING: 'warning', Transaction.STATUS_ACCEPTED: 'success',
type_error: 'notSent'}
try:
tt_status = Transaction.objects.get(txid=obj.numero).last_status
except Transaction.DoesNotExist:
tt_status = type_error
return {'class': status_colours.get(tt_status, 'success')}
in tests.py
def test_suit_row_attributes(self):
self.assertEqual(self.admin_instance.suit_row_attributes(self.errortr_obj), {'class': 'notSent'})
Can someone help me, please?
For more :- https://django-suit.readthedocs.io/en/develop/list_attributes.html