mirror of
https://github.com/Infinidat/infi.clickhouse_orm.git
synced 2024-11-25 10:13:45 +03:00
tests: fix readonly error messages for v1.1.54335+
the commit that made the changes
59aa1359c8
This commit is contained in:
parent
99de0f6637
commit
6673841bf9
|
@ -20,11 +20,11 @@ class ReadonlyTestCase(TestCaseWithData):
|
|||
list(self.database.select('SELECT * from $table', Person))
|
||||
with self.assertRaises(ServerError) as cm:
|
||||
self.database.drop_table(Person)
|
||||
self._check_db_readonly_err(cm.exception)
|
||||
self._check_db_readonly_err(cm.exception, drop_table=True)
|
||||
|
||||
with self.assertRaises(ServerError) as cm:
|
||||
self.database.drop_database()
|
||||
self._check_db_readonly_err(cm.exception)
|
||||
self._check_db_readonly_err(cm.exception, drop_table=True)
|
||||
except ServerError as e:
|
||||
if e.code == 192 and e.message.startswith('Unknown user'):
|
||||
raise unittest.SkipTest('Database user "%s" is not defined' % username)
|
||||
|
@ -33,9 +33,12 @@ class ReadonlyTestCase(TestCaseWithData):
|
|||
finally:
|
||||
self.database = orig_database
|
||||
|
||||
def _check_db_readonly_err(self, exc):
|
||||
def _check_db_readonly_err(self, exc, drop_table=None):
|
||||
self.assertEqual(exc.code, 164)
|
||||
self.assertEqual(exc.message, 'Cannot execute query in readonly mode')
|
||||
if drop_table:
|
||||
self.assertEqual(exc.message, 'Cannot drop table in readonly mode')
|
||||
else:
|
||||
self.assertEqual(exc.message, 'Cannot insert into table in readonly mode')
|
||||
|
||||
def test_readonly_db_with_default_user(self):
|
||||
self._test_readonly_db('default')
|
||||
|
|
Loading…
Reference in New Issue
Block a user