test_conf_utils.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:functest 作者: opnfv 项目源码 文件源码
def test_configure_tempest_defcore_default(self):
        with mock.patch('functest.opnfv_tests.openstack.tempest.'
                        'conf_utils.configure_verifier',
                        return_value='test_conf_file'), \
            mock.patch('functest.opnfv_tests.openstack.tempest.'
                       'conf_utils.configure_tempest_update_params'), \
            mock.patch('functest.opnfv_tests.openstack.tempest.'
                       'conf_utils.ConfigParser.RawConfigParser.'
                       'set') as mset, \
            mock.patch('functest.opnfv_tests.openstack.tempest.'
                       'conf_utils.ConfigParser.RawConfigParser.'
                       'read') as mread, \
            mock.patch('functest.opnfv_tests.openstack.tempest.'
                       'conf_utils.ConfigParser.RawConfigParser.'
                       'write') as mwrite, \
            mock.patch('__builtin__.open', mock.mock_open()), \
            mock.patch('functest.opnfv_tests.openstack.tempest.'
                       'conf_utils.generate_test_accounts_file'), \
            mock.patch('functest.opnfv_tests.openstack.tempest.'
                       'conf_utils.shutil.copyfile'):
            conf_utils.configure_tempest_defcore(
                'test_dep_dir', 'test_image_id', 'test_flavor_id',
                'test_image_alt_id', 'test_flavor_alt_id', 'test_tenant_id')
            mset.assert_any_call('compute', 'image_ref', 'test_image_id')
            mset.assert_any_call('compute', 'image_ref_alt',
                                 'test_image_alt_id')
            mset.assert_any_call('compute', 'flavor_ref', 'test_flavor_id')
            mset.assert_any_call('compute', 'flavor_ref_alt',
                                 'test_flavor_alt_id')
            self.assertTrue(mread.called)
            self.assertTrue(mwrite.called)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号