def test_create_router_type_id(self): """Create router type: --id this_id myname.""" resource = 'routertype' cmd = routertype.RouterTypeCreate(test_cli20.MyApp(sys.stdout), None) template = 'Template 1' scheduler = 'my.scheduler:class_name' plugin_driver = 'my.plugin.driver:class_name' svc_helper = 'my.service.helper:class_name' agent_driver = 'my.agent.driver:class_name' myid = 'myid' args = [ '--id', myid, template, scheduler, plugin_driver, svc_helper, agent_driver ] position_names = [ 'template_id', 'scheduler', 'driver', 'cfg_agent_service_helper', 'cfg_agent_driver' ] position_values = [ template, scheduler, plugin_driver, svc_helper, agent_driver ] self._test_create_resource(resource, cmd, None, myid, args, position_names, position_values, id=myid)
def _test_create_router_type_optional_args(self, name=None, desc=None, ha_enabled=None, haenabled=None, unshared=None, slot_need=None, slotneed=None): resource = 'routertype' cmd = routertype.RouterTypeCreate(test_cli20.MyApp(sys.stdout), None) myid = 'myid' template = 'Template 1' scheduler = 'my.scheduler:class_name' plugin_driver = 'my.plugin.driver:class_name' svc_helper = 'my.service.helper:class_name' agent_driver = 'my.agent.driver:class_name' args = [] expected = {} if desc is not None: args += ['--description', desc] expected['description'] = desc if ha_enabled is not None: args += ['--ha_enabled'] expected['ha_enabled_by_default'] = True if haenabled is not None: args += ['--ha-enabled'] expected['ha_enabled_by_default'] = True if unshared is not None: args += ['--unshared'] expected['shared'] = False if slot_need is not None: args += ['--slot_need', slot_need] expected['slot_need'] = slot_need if slotneed is not None: args += ['--slot-need', slotneed] expected['slot_need'] = slotneed position_names = [ 'template_id', 'scheduler', 'driver', 'cfg_agent_service_helper', 'cfg_agent_driver' ] position_values = [ template, scheduler, plugin_driver, svc_helper, agent_driver ] for p_v in position_values: args.append(p_v) self._test_create_resource(resource, cmd, name, myid, args, position_names, position_values, **expected)