add tests for migration

This commit is contained in:
Sarah Hoffmann
2021-12-01 20:27:40 +01:00
parent 7be164e2a5
commit a52ed366e4
4 changed files with 259 additions and 5 deletions

View File

@@ -37,6 +37,15 @@ class CursorForTesting(psycopg2.extras.DictCursor):
return num == 1
def index_exists(self, table, index):
""" Check that an indexwith the given name exists on the given table.
"""
num = self.scalar("""SELECT count(*) FROM pg_indexes
WHERE tablename = %s and indexname = %s""",
(table, index))
return num == 1
def table_rows(self, table, where=None):
""" Return the number of rows in the given table.
"""