def validate_contract_abi(self, value): try: contract_abi = json.loads(value) except json.JSONDecodeError: raise serializers.ValidationError('Invalid JSON') if not is_valid_contract_abi(contract_abi): raise serializers.ValidationError('Could not validate ABI') return contract_abi
def validate_contract_abi(contract_abi): if not is_valid_contract_abi(contract_abi): raise ValidationError("Invalid contract ABI")
def test_is_valid_contract_abi(contract_abi, expected): actual = is_valid_contract_abi(contract_abi) assert actual is expected