[test] don't leave NULL columns around when making an attribute required
authorJulien Cristau <julien.cristau@logilab.fr>
Mon, 18 May 2015 20:00:06 +0200
changeset 10436 6493c8bf521d
parent 10435 5b33ca2c61e0
child 10437 9cddd711419c
[test] don't leave NULL columns around when making an attribute required It doesn't matter on sqlite (it doesn't do ALTER COLUMN), but when running this test on postgresql it fails to add the 'NOT NULL' constraint otherwise.
hooks/test/unittest_syncschema.py
--- a/hooks/test/unittest_syncschema.py	Tue Jun 23 10:02:41 2015 +0200
+++ b/hooks/test/unittest_syncschema.py	Mon May 18 20:00:06 2015 +0200
@@ -295,6 +295,7 @@
             cnx.execute('SET DEF cardinality "11" '
                          'WHERE DEF relation_type RT, DEF from_entity E,'
                          'RT name "surname", E name "CWUser"')
+            cnx.execute('SET U surname "Doe" WHERE U surname NULL')
             cnx.commit()
             # should not be able anymore to add cwuser without surname
             self.assertRaises(ValidationError, self.create_user, cnx, "toto")