@@ -20,7 +20,8 @@ def test_table_dump(self):
20
20
,
21
21
"CREATE TABLE t1(id integer primary key, s1 text, " \
22
22
"t1_i1 integer not null, i2 integer, unique (s1), " \
23
- "constraint t1_idx1 unique (i2));"
23
+ "constraint t1_idx1 unique (i2), " \
24
+ "constraint t1_i1_idx1 unique (t1_i1));"
24
25
,
25
26
"INSERT INTO \" t1\" VALUES(1,'foo',10,20);"
26
27
,
@@ -30,6 +31,9 @@ def test_table_dump(self):
30
31
"t2_i2 integer, primary key (id)," \
31
32
"foreign key(t2_i1) references t1(t1_i1));"
32
33
,
34
+ # Foreign key violation.
35
+ "INSERT INTO \" t2\" VALUES(1,2,3);"
36
+ ,
33
37
"CREATE TRIGGER trigger_1 update of t1_i1 on t1 " \
34
38
"begin " \
35
39
"update t2 set t2_i1 = new.t1_i1 where t2_i1 = old.t1_i1; " \
@@ -41,8 +45,12 @@ def test_table_dump(self):
41
45
[self .cu .execute (s ) for s in expected_sqls ]
42
46
i = self .cx .iterdump ()
43
47
actual_sqls = [s for s in i ]
44
- expected_sqls = ['BEGIN TRANSACTION;' ] + expected_sqls + \
45
- ['COMMIT;' ]
48
+ expected_sqls = [
49
+ "PRAGMA foreign_keys=OFF;" ,
50
+ "BEGIN TRANSACTION;"
51
+ ] + expected_sqls + [
52
+ "COMMIT;"
53
+ ]
46
54
[self .assertEqual (expected_sqls [i ], actual_sqls [i ])
47
55
for i in range (len (expected_sqls ))]
48
56
0 commit comments