• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python test_base._get_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中neutron.tests.unit.api.v2.test_base._get_path函数的典型用法代码示例。如果您正苦于以下问题:Python _get_path函数的具体用法?Python _get_path怎么用?Python _get_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了_get_path函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_delete_floating_ip

 def test_delete_floating_ip(self):
     self.instance.get_port = mock.Mock(return_value=fake_port)
     url = test_base._get_path('floatingips', id=fake_floating_ip_id)
     resp = self._test_send_msg(None, 'delete', url)
     self.instance.delete_floatingip.\
         assert_called_once_with(mock.ANY, fake_floating_ip_id)
     self.assertEqual(resp.status_int, exc.HTTPNoContent.code)
开发者ID:wuwenbin2,项目名称:networking-onos-fuel-kilo,代码行数:7,代码来源:test_driver.py


示例2: _post_network_with_provider_attrs

 def _post_network_with_provider_attrs(self, ctx, expect_errors=False):
     data = self._prepare_net_data()
     env = {'neutron.context': ctx}
     res = self.api.post(test_base._get_path('networks', fmt=self.fmt),
                         self.serialize({'network': data}),
                         content_type='application/' + self.fmt,
                         extra_environ=env,
                         expect_errors=expect_errors)
     return res, data
开发者ID:eayunstack,项目名称:neutron,代码行数:9,代码来源:test_providernet.py


示例3: test_health_monitor_delete

 def test_health_monitor_delete(self):
     entity_id = _uuid()
     res = self.api.delete(
         test_base._get_path('lbaas/healthmonitors',
                             id=entity_id, fmt=self.fmt))
     delete_entity = getattr(self.plugin.return_value,
                             "delete_healthmonitor")
     delete_entity.assert_called_with(mock.ANY, entity_id)
     self.assertEqual(exc.HTTPNoContent.code, res.status_int)
开发者ID:fnaval,项目名称:neutron-lbaas,代码行数:9,代码来源:test_loadbalancer_plugin.py


示例4: test_pool_member_delete

 def test_pool_member_delete(self):
     entity_id = _uuid()
     res = self.api.delete(
         test_base._get_path('lbaas/pools/pid1/members',
                             id=entity_id, fmt=self.fmt))
     delete_entity = getattr(self.plugin.return_value,
                             "delete_pool_member")
     delete_entity.assert_called_with(mock.ANY, entity_id,
                                      pool_id='pid1')
     self.assertEqual(exc.HTTPNoContent.code, res.status_int)
开发者ID:fnaval,项目名称:neutron-lbaas,代码行数:10,代码来源:test_loadbalancer_plugin.py


示例5: test_create_router

 def test_create_router(self):
     router_info = copy.deepcopy(fake_router_object['router'])
     router_info.update({'status': 'ACTIVE', 'id': fake_router_uuid})
     self.instance.create_router.return_value = router_info
     self.instance.get_routers_count.return_value = 0
     url = test_base._get_path('routers', fmt=self.fmt)
     resp = self._test_send_msg(fake_router_object, 'post', url)
     self.instance.create_router. \
         assert_called_once_with(mock.ANY, router=fake_router_object)
     self._verify_resp(resp, exc.HTTPCreated.code,
                       'router', fake_router_uuid)
开发者ID:openstack,项目名称:networking-huawei,代码行数:11,代码来源:test_driver.py


示例6: _test_entity_delete

 def _test_entity_delete(self, entity):
     """Does the entity deletion based on naming convention."""
     entity_id = str(uuid.uuid4())
     path = self._resource_prefix + "/" if self._resource_prefix else ""
     path += self._plural_mappings.get(entity, entity + "s")
     if self._translate_resource_name:
         path = path.replace("_", "-")
     res = self.api.delete(test_base._get_path(path, id=entity_id, fmt=self.fmt))
     delete_entity = getattr(self.plugin.return_value, "delete_" + entity)
     delete_entity.assert_called_with(mock.ANY, entity_id)
     self.assertEqual(res.status_int, exc.HTTPNoContent.code)
开发者ID:davidcusatis,项目名称:neutron,代码行数:11,代码来源:base.py


示例7: _test_entity_delete

 def _test_entity_delete(self, entity):
     """Does the entity deletion based on naming convention."""
     entity_id = uuidutils.generate_uuid()
     path = self._resource_prefix + '/' if self._resource_prefix else ''
     path += self._plural_mappings.get(entity, entity + 's')
     if self._translate_resource_name:
         path = path.replace('_', '-')
     res = self.api.delete(
         test_base._get_path(path, id=entity_id, fmt=self.fmt))
     delete_entity = getattr(self.plugin.return_value, "delete_" + entity)
     delete_entity.assert_called_with(mock.ANY, entity_id)
     self.assertEqual(exc.HTTPNoContent.code, res.status_int)
开发者ID:cubeek,项目名称:neutron,代码行数:12,代码来源:base.py


示例8: test_update_router

 def test_update_router(self):
     router_info = copy.deepcopy(fake_router_object['router'])
     router_info.update(fake_router_external_info)
     router_info.update({'status': 'ACTIVE', 'id': fake_router_uuid})
     self.instance.update_router.return_value = router_info
     router_request = {'router': fake_router_external_info}
     url = test_base._get_path('routers', id=fake_router_uuid, fmt=self.fmt)
     resp = self._test_send_msg(router_request, 'put', url)
     self.instance.update_router. \
         assert_called_once_with(mock.ANY, fake_router_uuid,
                                 router=router_request)
     self._verify_resp(resp, exc.HTTPOk.code, 'router', fake_router_uuid)
开发者ID:openstack,项目名称:networking-huawei,代码行数:12,代码来源:test_driver.py


示例9: test_remove_router_interface

 def test_remove_router_interface(self):
     interface_info = {'tenant_id': fake_tenant_id,
                       'id': fake_router_uuid}
     interface_info.update(fake_interface_remove)
     self.instance.remove_router_interface.return_value = interface_info
     url = test_base._get_path('routers', id=fake_router_uuid,
                               action='remove_router_interface',
                               fmt=self.fmt)
     resp = self._test_send_msg(fake_interface_remove, 'put', url)
     self.instance.remove_router_interface. \
         assert_called_once_with(mock.ANY, fake_router_uuid,
                                 fake_interface_remove)
     self._verify_resp(resp, exc.HTTPOk.code, None, fake_router_uuid)
开发者ID:openstack,项目名称:networking-huawei,代码行数:13,代码来源:test_driver.py


示例10: _put_network_with_provider_attrs

 def _put_network_with_provider_attrs(self, ctx, expect_errors=False):
     data = self._prepare_net_data()
     env = {'neutron.context': ctx}
     instance = self.plugin.return_value
     instance.get_network.return_value = {'tenant_id': ctx.tenant_id,
                                          'shared': False}
     net_id = uuidutils.generate_uuid()
     res = self.api.put(test_base._get_path('networks',
                                            id=net_id,
                                            fmt=self.fmt),
                        self.serialize({'network': data}),
                        extra_environ=env,
                        expect_errors=expect_errors)
     return res, data, net_id
开发者ID:eayunstack,项目名称:neutron,代码行数:14,代码来源:test_providernet.py


示例11: test_create_floating_ip

    def test_create_floating_ip(self):
        floatingip_info = copy.deepcopy(fake_floating_ip['floatingip'])
        floatingip_info.update(fake_floating_ip_update_info)
        floatingip_info.update({'status': 'ACTIVE', 'fixed_ip_address': None})

        self.instance.create_floatingip.return_value = floatingip_info
        self.instance.get_floatingips_count.return_value = 0
        self.instance.get_port = mock.Mock(return_value=fake_port)

        floating_ip_request = {'floatingip': fake_floating_ip_update_info}
        url = test_base._get_path('floatingips', fmt=self.fmt)
        resp = self._test_send_msg(floating_ip_request, 'post', url)
        self.instance.create_floatingip.\
            assert_called_once_with(mock.ANY,
                                    floatingip=floating_ip_request)
        self._verify_resp(resp, exc.HTTPCreated.code,
                          'floatingip', fake_floating_ip_id)
开发者ID:wuwenbin2,项目名称:networking-onos-fuel-kilo,代码行数:17,代码来源:test_driver.py


示例12: test_update_floating_ip

    def test_update_floating_ip(self):
        fake_floating_ip_update_info = {'port_id': None}
        floatingip_info = copy.deepcopy(fake_floating_ip['floatingip'])
        floatingip_info.update(fake_floating_ip_update_info)
        floatingip_info.update({'status': 'ACTIVE',
                                'tenant_id': fake_tenant_id,
                                'floating_network_id': fake_network_id,
                                'fixed_ip_address': None,
                                'floating_ip_address': '172.24.4.228'})

        self.instance.update_floatingip.return_value = floatingip_info
        self.instance.get_port = mock.Mock(return_value=fake_port)
        floating_ip_request = {'floatingip': fake_floating_ip_update_info}
        url = test_base._get_path('floatingips',
                                  id=fake_floating_ip_id, fmt=self.fmt)
        resp = self._test_send_msg(floating_ip_request, 'put', url)
        self.instance.update_floatingip.\
            assert_called_once_with(mock.ANY,
                                    fake_floating_ip_id,
                                    floatingip=floating_ip_request)
        self._verify_resp(resp, exc.HTTPOk.code,
                          'floatingip', fake_floating_ip_id)
开发者ID:wuwenbin2,项目名称:networking-onos-fuel-kilo,代码行数:22,代码来源:test_driver.py


示例13: test_delete_router

 def test_delete_router(self):
     url = test_base._get_path('routers', id=fake_router_uuid, fmt=self.fmt)
     resp = self._test_send_msg(None, 'delete', url)
     self.instance.delete_router.assert_called_once_with(mock.ANY,
                                                         fake_router_uuid)
     self.assertEqual(resp.status_int, exc.HTTPNoContent.code)
开发者ID:openstack,项目名称:networking-huawei,代码行数:6,代码来源:test_driver.py



注:本文中的neutron.tests.unit.api.v2.test_base._get_path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python test_api_v2._uuid函数代码示例发布时间:2022-05-27
下一篇:
Python test_extensions.setup_extensions_middleware函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap