comparison test/test_sqlite.py @ 7206:521d98231e5c

Test self.db.db_version_updated in schema upgrade paths A user on the roundup-users mailing list reported that a 'roundup-admin migrate' reported that changes were needed. But it should have done the migration. roundup-admin uses the property db.db_version_updated to tell if there was a migration. Testing never looked at that property. Add a test for that property in all migration updates. AFAICT the test is always successful. So no bug uncovered by these tests.
author John Rouillard <rouilj@ieee.org>
date Thu, 02 Mar 2023 17:01:39 -0500
parents a96a239db0d9
children 39c482e6a246
comparison
equal deleted inserted replaced
7205:1a3d4703c7d6 7206:521d98231e5c
106 return 106 return
107 107
108 # test upgrade adding __fts table 108 # test upgrade adding __fts table
109 self.db.post_init() 109 self.db.post_init()
110 110
111 self.assertEqual(self.db.db_version_updated, True)
112
111 # select should now work. 113 # select should now work.
112 self.db.sql("select * from __fts") 114 self.db.sql("select * from __fts")
113 115
114 # we should be at the current db version 116 # we should be at the current db version
115 self.assertEqual(self.db.database_schema['version'], 117 self.assertEqual(self.db.database_schema['version'],
158 return 160 return
159 161
160 # test upgrade altering row 162 # test upgrade altering row
161 self.db.post_init() 163 self.db.post_init()
162 164
165 self.assertEqual(self.db.db_version_updated, True)
166
163 # verify they keep all signifcant digits before the decimal point 167 # verify they keep all signifcant digits before the decimal point
164 for tablename in ['otk', 'session']: 168 for tablename in ['otk', 'session']:
165 Bdb = handle[tablename] 169 Bdb = handle[tablename]
166 Bdb.sql( 170 Bdb.sql(
167 'insert into %(name)ss(%(name)s_key, %(name)s_time, %(name)s_value) ' 171 'insert into %(name)ss(%(name)s_key, %(name)s_time, %(name)s_value) '

Roundup Issue Tracker: http://roundup-tracker.org/