def setup_routes(app, disp): # V2 Routes disp.set_handler('v2_network', networks.NetworkV2()) disp.set_handler('v2_networks', networks.NetworksV2()) disp.set_handler('v2_subnet', subnets.SubnetV2()) disp.set_handler('v2_subnets', subnets.SubnetsV2()) disp.set_handler('v2_extensions', extensions.ExtensionsV2()) sl_common.add_hooks(app)
def test_on_get_subnetsv2_response_list(self): """Test list function""" client, env = get_client_env(query_string='name=10') SUBNET_DICT['id'] = 10 client['Account'].getSubnets.return_value = [SUBNET_DICT] req = api.Request(env, sl_client=client) resp = falcon.Response() subnets.SubnetsV2().on_get(req, resp) self.check_body_response(resp.body['subnets'][0])
def test_on_get_response_subnetsv2_show_no_match(self): """Test show function in SubnetsV2 with no matching ID""" client, env = get_client_env(query_string='name=10') SUBNET_DICT['id'] = 9 client['Account'].getSubnets.return_value = [] req = api.Request(env, sl_client=client) resp = falcon.Response() subnets.SubnetsV2().on_get(req, resp) self.assertEqual(resp.status, 200) self.assertEqual(resp.body['subnets'], [])
def setup_routes(app, disp): # V2 Routes disp.set_handler('index', index.Index(app)) disp.set_handler('v2_detail', versionv2.VersionV2(app)) disp.set_handler('v2_network', networks.NetworkV2()) disp.set_handler('v2_networks', networks.NetworksV2()) disp.set_handler('v2_subnet', subnets.SubnetV2()) disp.set_handler('v2_subnets', subnets.SubnetsV2()) disp.set_handler('v2_extensions', extensions.ExtensionsV2()) sl_common.add_hooks(app)
def test_on_get_response_subnetsv2_show(self): """Test show function in SubnetsV2""" client, env = get_client_env() SUBNET_DICT['id'] = 10 client['Account'].getSubnets.return_value = [SUBNET_DICT] req = api.Request(env, sl_client=client) resp = falcon.Response() subnets.SubnetsV2().on_get(req, resp) self.assertEqual(resp.status, 200) self.check_body_response(resp.body['subnets'][0])