def test_partition_name_withalt(self): with a10.A10WriteContext(self.handler, self.ctx, self.m, device_name='axadp-alt') as c: # shared_partition has no effect on an ADP configured device self.assertEqual(c.partition_name, self.m.tenant_id[0:13])
def test_use_parent_no_parent(self): fake_keystone = mock.MagicMock() fake_keystone.client.projects.get = mock.MagicMock(return_value=fake_objs.FakeKeystoneClient()) a10.a10_context.keystone_helpers.KeystoneFromContext = mock.MagicMock(return_value=fake_keystone) with a10.A10WriteContext(self.handler, self.ctx, self.m, device_name='axadp-noalt') as c: self.assertEqual(c.partition_key, "get-off-my-lawn")
def test_write_e(self): try: with a10.A10WriteContext(self.handler, self.ctx, self.m) as c: c raise FakeException() except FakeException: self.empty_close_mocks()
def test_write_no_write(self): with a10.A10WriteContext(self.handler, self.ctx, self.m, device_name='ax-nowrite') as c: c self.a.last_client.system.action.write_memory.assert_not_called() self.a.last_client.session.close.assert_called_with()
def test_ha(self): with a10.A10WriteContext(self.handler, self.ctx, self.m, device_name='ax4') as c: c self.a.last_client.ha.sync.assert_called_with('1.1.1.1', 'admin', 'a10') self.a.last_client.session.close.assert_called_with()
def test_partition_name(self): with a10.A10WriteContext(self.handler, self.ctx, self.m, device_name='axadp-noalt') as c: self.assertEqual(c.partition_name, self.m.tenant_id[0:13])
def test_partition_name_withalt(self): with a10.A10WriteContext(self.handler, self.ctx, self.m, device_name='axadp-alt') as c: self.assertEqual(c.partition_name, 'mypart')
def test_write(self): with a10.A10WriteContext(self.handler, self.ctx, self.m) as c: c self.a.last_client.system.action.write_memory.assert_called_with() self.a.last_client.session.close.assert_called_with()