

def _test_get_driver(self, get_method, id=None, test_for_none=False, is_admin=False):
    with self.hosting_device_template() as hdt:
        context = self._get_test_context(tenant_id=hdt['hosting_device_template']['tenant_id'], is_admin=is_admin)
        driver_getter = getattr(self._devmgr, get_method)
        template_id = (id or hdt['hosting_device_template']['id'])
        driver = driver_getter(context, template_id)
        if test_for_none:
            self.assertIsNone(driver)
        else:
            self.assertIsNotNone(driver)

dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/tests/unit/cisco/device_manager/test_db_device_manager.py TestDeviceManagerDBPlugin._test_get_driver/original