l3: an unit test for set_extra_attr_value

Add an unit test for set_extra_attr_value to check if
exception is raised when it's called out of db transaction.
This patch is follow up for I0e2707222b1f91199cf466c997c0e691679fd3a4

Change-Id: I1c9bdf88ceba8ac07c8501b2f5590bc6adc6c337
Partial-bug: #1745633
This commit is contained in:
Isaku Yamahata 2018-02-14 23:25:40 -08:00
parent 91b07eabcc
commit 44b966837d

View File

@ -581,6 +581,11 @@ class ExtraAttributesMixinTestCase(testlib_api.SqlTestCase):
self.mixin.set_extra_attr_value(self.ctx, self.router,
'bad', 'value')
def test_set_attrs_and_extend_no_transaction(self):
with testtools.ExpectedException(RuntimeError):
self.mixin.set_extra_attr_value(self.ctx, self.router,
'ha_vr_id', 99)
def test__extend_extra_router_dict_defaults(self):
rdict = {}
self.mixin._extend_extra_router_dict(rdict, self.router)