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

Python testlib.get_fixture函数代码示例

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

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



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

示例1: test_load_config_for_connection_with_env

 def test_load_config_for_connection_with_env(self):
     os.environ['EAPI_CONF'] = get_fixture('eapi.conf')
     pyeapi.client.load_config(random_string())
     cfg = pyeapi.client.config.get_connection('test1')
     self.assertEqual(cfg['host'], '192.168.1.16')
     self.assertEqual(cfg['username'], 'eapi')
     self.assertEqual(cfg['password'], 'password')
开发者ID:GaryCarneiro,项目名称:pyeapi,代码行数:7,代码来源:test_client.py


示例2: test_load_config

 def test_load_config(self):
     conf = get_fixture('eapi.conf')
     pyeapi.client.load_config(conf)
     self.assertEqual(len(pyeapi.client.config.sections()), 3)
     for name in ['localhost', 'test1', 'test2']:
         name = 'connection:%s' % name
         self.assertIn(name, pyeapi.client.config.sections())
开发者ID:GaryCarneiro,项目名称:pyeapi,代码行数:7,代码来源:test_client.py


示例3: test_node_returns_startup_config

 def test_node_returns_startup_config(self):
     node = pyeapi.client.Node(None)
     get_config_mock = Mock(name='get_config')
     config = open(get_fixture('running_config.text')).read()
     get_config_mock.return_value = config
     node.get_config = get_config_mock
     self.assertIsInstance(node.startup_config, str)
开发者ID:CullyB,项目名称:pyeapi,代码行数:7,代码来源:test_client.py


示例4: test_node_returns_cached_startup_confgi

 def test_node_returns_cached_startup_confgi(self):
     node = pyeapi.client.Node(None)
     config_file = open(get_fixture('running_config.text'))
     config = config_file.read()
     config_file.close()
     node._startup_config = config
     self.assertEqual(node.startup_config, config)
开发者ID:GaryCarneiro,项目名称:pyeapi,代码行数:7,代码来源:test_client.py


示例5: test_load_config_for_connection_with_filename

 def test_load_config_for_connection_with_filename(self):
     conf = get_fixture('eapi.conf')
     pyeapi.client.load_config(filename=conf)
     cfg = pyeapi.client.config.get_connection('test1')
     self.assertEqual(cfg['host'], '192.168.1.16')
     self.assertEqual(cfg['username'], 'eapi')
     self.assertEqual(cfg['password'], 'password')
开发者ID:GaryCarneiro,项目名称:pyeapi,代码行数:7,代码来源:test_client.py


示例6: setUp

    def setUp(self):
        pyeapi.client.load_config(filename=get_fixture('dut.conf'))
        config = pyeapi.client.config

        self.duts = list()
        for name in config.sections():
            if name.startswith('connection:') and 'localhost' not in name:
                name = name.split(':')[1]
                self.duts.append(pyeapi.client.connect_to(name))
开发者ID:CullyB,项目名称:pyeapi,代码行数:9,代码来源:test_client.py


示例7: test_connect_to_with_config

 def test_connect_to_with_config(self):
     transport = Mock()
     with patch.dict(pyeapi.client.TRANSPORTS, {'https': transport}):
         conf = get_fixture('eapi.conf')
         pyeapi.client.load_config(filename=conf)
         pyeapi.client.connect_to('test1')
         kwargs = dict(host='192.168.1.16', username='eapi',
                       password='password', port=None)
         transport.assert_called_once_with(**kwargs)
开发者ID:GaryCarneiro,项目名称:pyeapi,代码行数:9,代码来源:test_client.py


示例8: test_connect_return_node

 def test_connect_return_node(self):
     transport = Mock()
     with patch.dict(pyeapi.client.TRANSPORTS, {'https': transport}):
         conf = get_fixture('eapi.conf')
         pyeapi.client.load_config(filename=conf)
         node = pyeapi.client.connect(host='192.168.1.16', username='eapi',
                                      password='password', port=None,
                                      timeout=60, return_node=True)
         kwargs = dict(host='192.168.1.16', username='eapi',
                       password='password', port=None, timeout=60)
         transport.assert_called_once_with(**kwargs)
         self.assertIsNone(node._enablepwd)
开发者ID:brigoldberg,项目名称:pyeapi,代码行数:12,代码来源:test_client.py


示例9: setUp

    def setUp(self):
        pyeapi.client.load_config(filename=get_fixture('dut.conf'))
        config = pyeapi.client.config

        self.duts = list()
        for name in config.sections():
            if name.startswith('connection:') and 'localhost' not in name:
                name = name.split(':')[1]
                dut = pyeapi.client.connect_to(name)
                self.duts.append(dut)
                if dut._enablepwd is not None:
                    # If enable password defined for dut, set the
                    # enable password on the dut and clear it on tearDown
                    dut.config("enable secret %s" % dut._enablepwd)
开发者ID:brigoldberg,项目名称:pyeapi,代码行数:14,代码来源:test_client.py


示例10: __init__

 def __init__(self, *args, **kwargs):
     super(TestApiIpinterfaces, self).__init__(*args, **kwargs)
     self.instance = pyeapi.api.ipinterfaces.instance(None)
     self.config = open(get_fixture('running_config.text')).read()
开发者ID:brigoldberg,项目名称:pyeapi,代码行数:4,代码来源:test_api_ipinterfaces.py


示例11: __init__

 def __init__(self, *args, **kwargs):
     super(TestApiStaticroute, self).__init__(*args, **kwargs)
     self.instance = pyeapi.api.staticroute.StaticRoute(None)
     self.config = open(get_fixture('running_config.text')).read()
开发者ID:arista-eosplus,项目名称:pyeapi,代码行数:4,代码来源:test_api_staticroute.py


示例12: test_hosts_for_tag_returns_names

 def test_hosts_for_tag_returns_names(self):
     conf = get_fixture('eapi.conf')
     pyeapi.client.load_config(conf)
     result = pyeapi.client.hosts_for_tag('tag1')
     self.assertEqual(sorted(['test1', 'test2']), sorted(result))
开发者ID:GaryCarneiro,项目名称:pyeapi,代码行数:5,代码来源:test_client.py


示例13: test_config_for_replaces_host_w_name

 def test_config_for_replaces_host_w_name(self):
     conf = get_fixture('nohost.conf')
     pyeapi.client.load_config(conf)
     cfg = pyeapi.config_for('test')
     self.assertEqual(cfg['host'], 'test')
开发者ID:GaryCarneiro,项目名称:pyeapi,代码行数:5,代码来源:test_client.py


示例14: get_running_config

def get_running_config():
    return get_fixture('running_config.text')
开发者ID:dathelen,项目名称:pyeapi,代码行数:2,代码来源:test_api_stp.py


示例15: __init__

 def __init__(self, *args, **kwargs):
     super(TestApiSwitchports, self).__init__(*args, **kwargs)
     self.instance = pyeapi.api.switchports.instance(None)
     self.config = open(get_fixture('running_config.text')).read()
开发者ID:arista-eosplus,项目名称:pyeapi,代码行数:4,代码来源:test_api_switchports.py


示例16: __init__

 def __init__(self, *args, **kwargs):
     super(TestApiNtp, self).__init__(*args, **kwargs)
     self.instance = pyeapi.api.ntp.Ntp(None)
     self.config = open(get_fixture('running_config.text')).read()
开发者ID:arista-eosplus,项目名称:pyeapi,代码行数:4,代码来源:test_api_ntp.py


示例17: __init__

 def __init__(self, *args, **kwargs):
     super(TestApiRoutemaps, self).__init__(*args, **kwargs)
     self.instance = pyeapi.api.routemaps.Routemaps(None)
     self.config = open(get_fixture('running_config.routemaps')).read()
开发者ID:dathelen,项目名称:pyeapi,代码行数:4,代码来源:test_api_routemaps.py


示例18: __init__

 def __init__(self, *args, **kwargs):
     super(TestApiPortchannelInterface, self).__init__(*args, **kwargs)
     self.instance = pyeapi.api.interfaces.PortchannelInterface(None)
     self.config = open(get_fixture('running_config.portchannel')).read()
开发者ID:arista-eosplus,项目名称:pyeapi,代码行数:4,代码来源:test_api_interfaces.py


示例19: test_load_config_env_path

 def test_load_config_env_path(self):
     os.environ['EAPI_CONF'] = get_fixture('env_path.conf')
     pyeapi.client.config.autoload()
     self.assertIn('connection:env_path', pyeapi.client.config.sections())
开发者ID:brigoldberg,项目名称:pyeapi,代码行数:4,代码来源:test_client.py


示例20: test_load_config_yaml

 def test_load_config_yaml(self):
     conf = get_fixture('eapi.conf.yaml')
     pyeapi.client.load_config(filename=conf)
     conns = pyeapi.client.config.connections
     self.assertEqual(conns, ['localhost'])
开发者ID:brigoldberg,项目名称:pyeapi,代码行数:5,代码来源:test_client.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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