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

Python test_api_v2._uuid函数代码示例

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

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



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

示例1: test_full_uuids_skip_port_id_lookup

 def test_full_uuids_skip_port_id_lookup(self):
     plugin = manager.NeutronManager.get_plugin()
     # when full UUIDs are provided, the _or statement should only
     # have one matching 'IN' critiera for all of the IDs
     with contextlib.nested(
         mock.patch('neutron.plugins.ml2.db.or_'),
         mock.patch('neutron.plugins.ml2.db.db_api.get_session')
     ) as (or_mock, sess_mock):
         fmock = sess_mock.query.return_value.outerjoin.return_value.filter
         # return no ports to exit the method early since we are mocking
         # the query
         fmock.return_value.all.return_value = []
         plugin.get_ports_from_devices([test_api_v2._uuid(),
                                        test_api_v2._uuid()])
         # the or_ function should only have one argument
         or_mock.assert_called_once_with(mock.ANY)
开发者ID:absolutarin,项目名称:neutron,代码行数:16,代码来源:test_security_group.py


示例2: _setUp

    def _setUp(self):
        self.servername = test_api_v2._uuid()
        self.cert_base = cfg.CONF.RESTPROXY.ssl_cert_directory
        self.host_cert_val = 'DUMMYCERTFORHOST%s' % self.servername
        self.host_cert_path = os.path.join(
            self.cert_base,
            'host_certs',
            '%s.pem' % self.servername
        )
        self.comb_cert_path = os.path.join(
            self.cert_base,
            'combined',
            '%s.pem' % self.servername
        )
        self.ca_certs_path = os.path.join(
            self.cert_base,
            'ca_certs'
        )
        cfg.CONF.set_override('servers', ["%s:443" % self.servername],
                              'RESTPROXY')
        self.setup_patches()

        # Mock method SSL lib uses to grab cert from server
        self.sslgetcert_m = mock.patch(SSLGETCERT, create=True).start()
        self.sslgetcert_m.return_value = self.host_cert_val

        # Mock methods that write and read certs from the file-system
        self.fileput_m = mock.patch(FILEPUT, create=True).start()
        self.certcomb_m = mock.patch(CERTCOMBINER, create=True).start()
        self.getcacerts_m = mock.patch(GETCACERTS, create=True).start()

        # this is used to configure what certificate contents the fake HTTPS
        # lib should expect to receive
        self.fake_certget_m = mock.patch(FAKECERTGET, create=True).start()
开发者ID:50infivedays,项目名称:neutron,代码行数:34,代码来源:test_ssl.py


示例3: test_rollback_on_router_create

 def test_rollback_on_router_create(self):
     tid = test_api_v2._uuid()
     self.errhttpPatch = patch("httplib.HTTPConnection", create=True, new=fake_server.HTTPConnectionMock500)
     self.errhttpPatch.start()
     self._create_router("json", tid)
     self.errhttpPatch.stop()
     self.assertTrue(len(self._get_routers(tid)) == 0)
开发者ID:netscaler,项目名称:neutron,代码行数:7,代码来源:test_router_db.py


示例4: test_error_no_cert

 def test_error_no_cert(self):
     # since there will already be a host cert, sticky should not take
     # effect and there will be an error because the host cert's contents
     # will be incorrect
     tid = test_api_v2._uuid()
     data = {}
     data["network"] = {"tenant_id": tid, "name": "name", "admin_state_up": True}
     with mock.patch(HTTPS, new=fake_server.HTTPSHostValidation):
         req = self.new_create_request("networks", data, "json")
         res = req.get_response(self.api)
     self.assertEqual(res.status_int, webob.exc.HTTPInternalServerError.code)
     self.hcertpath_p.assert_has_calls([mock.call(os.path.join(self.cert_base, "host_certs"), self.servername)])
     # sticky is enabled, but a host cert already exists so it shant fetch
     self.assertFalse(self.sslgetcert_m.call_count)
     # no ca certs, so host cert only for this combined cert
     self.certcomb_m.assert_has_calls([mock.call([self.host_cert_path], self.comb_cert_path)])
开发者ID:cboling,项目名称:SDNdbg,代码行数:16,代码来源:test_ssl.py


示例5: test_error_no_cert

 def test_error_no_cert(self):
     # since there will already be a host cert, sticky should not take
     # effect and there will be an error because the host cert's contents
     # will be incorrect
     tid = test_api_v2._uuid()
     data = {}
     data['network'] = {'tenant_id': tid, 'name': 'name',
                        'admin_state_up': True}
     req = self.new_create_request('networks', data, 'json')
     res = req.get_response(self.api)
     self.assertEqual(res.status_int,
                      webob.exc.HTTPInternalServerError.code)
     self.hcertpath_p.assert_has_calls([
         mock.call(os.path.join(self.cert_base, 'host_certs'),
                   self.servername)
     ])
     # sticky is enabled, but a host cert already exists so it shant fetch
     self.assertFalse(self.sslgetcert_m.call_count)
     # no ca certs, so host cert only for this combined cert
     self.certcomb_m.assert_has_calls([mock.call([self.host_cert_path],
                                                 self.comb_cert_path)])
开发者ID:50infivedays,项目名称:neutron,代码行数:21,代码来源:test_ssl.py


示例6: test_rollback_on_router_create

 def test_rollback_on_router_create(self):
     tid = test_api_v2._uuid()
     self.httpPatch.stop()
     with mock.patch(HTTPCON, new=fake_server.HTTPConnectionMock500):
         self._create_router('json', tid)
     self.assertTrue(len(self._get_routers(tid)) == 0)
开发者ID:AsherBond,项目名称:quantum,代码行数:6,代码来源:test_router_db.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python test_extensions.setup_extensions_middleware函数代码示例发布时间:2022-05-27
下一篇:
Python test_base._get_path函数代码示例发布时间: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