[test] Add test method required by d41832121b29 3.23
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 19 Oct 2016 21:08:04 +0200
branch3.23
changeset 11720 c1f19a62a6dd
parent 11719 36443c44b9a5
child 11721 8b287ad7b95b
[test] Add test method required by d41832121b29
cubicweb/server/test/unittest_migractions.py
--- a/cubicweb/server/test/unittest_migractions.py	Wed Oct 19 15:57:52 2016 +0200
+++ b/cubicweb/server/test/unittest_migractions.py	Wed Oct 19 21:08:04 2016 +0200
@@ -113,6 +113,14 @@
         assert result, 'no table %s' % tablename
         return dict((x[0], (x[1], x[2])) for x in result)
 
+    def table_constraints(self, mh, tablename):
+        result = mh.sqlexec(
+            "SELECT DISTINCT constraint_name FROM information_schema.constraint_column_usage "
+            "WHERE LOWER(table_name) = '%(table)s' AND constraint_name LIKE 'cstr%%'"
+            % {'table': tablename.lower()})
+        assert result, 'no table %s' % tablename
+        return set(x[0] for x in result)
+
 
 class MigrationCommandsTC(MigrationTC):