Ticket #28859: 28859.diff

File 28859.diff, 1.3 KB (added by Mariusz Felisiak, 7 years ago)
  • tests/backends/oracle/tests.py

    diff --git a/tests/backends/oracle/tests.py b/tests/backends/oracle/tests.py
    index fd2435e5bb..39f11b4f0b 100644
    a b  
    11import unittest
    22
     3from ..models import Square
     4
    35from django.db import connection
    46from django.db.models.fields import BooleanField, NullBooleanField
     7from django.test import TransactionTestCase
    58
    69
    710@unittest.skipUnless(connection.vendor == 'oracle', 'Oracle tests')
    class Tests(unittest.TestCase):  
    6164            with self.subTest(field=field):
    6265                field.set_attributes_from_name('is_nice')
    6366                self.assertIn('"IS_NICE" IN (0,1)', field.db_check(connection))
     67
     68
     69class TriggerException(TransactionTestCase):
     70    available_apps = ['backends']
     71
     72    def test_database_trigger_exception_propagation(self):
     73        # Exception raised by trigger should be propagate to user.
     74        with connection.cursor() as cursor:
     75            # Create trigger that always raise "ORA-1403: no data found".
     76            cursor.execute("""
     77                CREATE OR REPLACE TRIGGER "TRG_NO_DATA_FOUND"
     78                AFTER INSERT ON "BACKENDS_SQUARE"
     79                FOR EACH ROW
     80                BEGIN
     81                    RAISE NO_DATA_FOUND;
     82                END;
     83            """)
     84        Square.objects.create(root=2, square=4)
Back to Top