Format of database error messages changed, update failing tests

This commit is contained in:
Itai Shirav 2019-05-12 10:27:10 +03:00
parent 595f2023e3
commit a765b5fe5f
3 changed files with 5 additions and 5 deletions

View File

@ -150,7 +150,7 @@ class DatabaseTestCase(TestCaseWithData):
exc = cm.exception
self.assertEqual(exc.code, 193)
self.assertEqual(exc.message, 'Wrong password for user default')
self.assertTrue(exc.message.startswith('Wrong password for user default'))
def test_nonexisting_db(self):
db = Database('db_not_here', autocreate=False)
@ -158,7 +158,7 @@ class DatabaseTestCase(TestCaseWithData):
db.create_table(Person)
exc = cm.exception
self.assertEqual(exc.code, 81)
self.assertEqual(exc.message, "Database db_not_here doesn't exist")
self.assertTrue(exc.message.startswith("Database db_not_here doesn't exist"))
# Create and delete the db twice, to ensure db_exists gets updated
for i in range(2):
# Now create the database - should succeed

View File

@ -209,7 +209,7 @@ class DistributedTestCase(_EnginesHelperTestCase):
exc = cm.exception
self.assertEqual(exc.code, 170)
self.assertEqual(exc.message, "Requested cluster 'cluster_name' not found")
self.assertTrue(exc.message.startswith("Requested cluster 'cluster_name' not found"))
def test_verbose_engine_two_superclasses(self):
class TestModel2(SampleModel):

View File

@ -36,9 +36,9 @@ class ReadonlyTestCase(TestCaseWithData):
def _check_db_readonly_err(self, exc, drop_table=None):
self.assertEqual(exc.code, 164)
if drop_table:
self.assertEqual(exc.message, 'Cannot drop table in readonly mode')
self.assertTrue(exc.message.startswith('Cannot drop table in readonly mode'))
else:
self.assertEqual(exc.message, 'Cannot insert into table in readonly mode')
self.assertTrue(exc.message.startswith('Cannot insert into table in readonly mode'))
def test_readonly_db_with_default_user(self):
self._test_readonly_db('default')