Convert base commands to ReadOnlyCommand
This adds a test for handling nested read-only execute() commands and converts some commands that were missed. Related-Bug: #1813213 Change-Id: I77332f1810fe09f8bce8c41cc11168b15923ecce
This commit is contained in:
parent
62f02f40d9
commit
547777a9cf
|
@ -180,7 +180,7 @@ class DbClearCommand(BaseCommand):
|
|||
setattr(record, self.column, value)
|
||||
|
||||
|
||||
class DbGetCommand(BaseCommand):
|
||||
class DbGetCommand(ReadOnlyCommand):
|
||||
def __init__(self, api, table, record, column):
|
||||
super(DbGetCommand, self).__init__(api)
|
||||
self.table = table
|
||||
|
@ -200,7 +200,7 @@ class DbGetCommand(BaseCommand):
|
|||
self.result = result
|
||||
|
||||
|
||||
class DbListCommand(BaseCommand):
|
||||
class DbListCommand(ReadOnlyCommand):
|
||||
def __init__(self, api, table, records, columns, if_exists, row=False):
|
||||
super(DbListCommand, self).__init__(api)
|
||||
self.table = table
|
||||
|
@ -263,7 +263,7 @@ class DbListCommand(BaseCommand):
|
|||
match=records_found[0])
|
||||
|
||||
|
||||
class DbFindCommand(BaseCommand):
|
||||
class DbFindCommand(ReadOnlyCommand):
|
||||
def __init__(self, api, table, *conditions, **kwargs):
|
||||
super(DbFindCommand, self).__init__(api)
|
||||
self.table = self.api._tables[table]
|
||||
|
|
|
@ -69,6 +69,10 @@ class TestBackendDb(base.FunctionalTestCase):
|
|||
columns=('name', 'datapath_type')).execute(check_error=True)
|
||||
self.assertTrue(all(b in res for b in self.bridges))
|
||||
|
||||
def test_db_list_nested(self):
|
||||
with self.api.transaction(check_error=True):
|
||||
self.test_db_list()
|
||||
|
||||
def test_db_list_record(self):
|
||||
res = self.api.db_list(
|
||||
'Bridge', [self.bridges[0]['name']],
|
||||
|
|
Loading…
Reference in New Issue