heat_tests.py 文件源码

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

项目:mos-horizon 作者: Mirantis 项目源码 文件源码
def test_get_template_files(self):
        tmpl = '''
    # comment

    heat_template_version: 2013-05-23
    resources:
      server1:
        type: OS::Nova::Server
        properties:
            flavor: m1.medium
            image: cirros
            user_data_format: RAW
            user_data:
              get_file: http://test.example/example
    '''
        expected_files = {u'http://test.example/example': b'echo "test"'}
        url = 'http://test.example/example'
        data = b'echo "test"'
        self.mox.StubOutWithMock(six.moves.urllib.request, 'urlopen')
        six.moves.urllib.request.urlopen(url).AndReturn(
            six.BytesIO(data))
        self.mox.ReplayAll()
        files = api.heat.get_template_files(template_data=tmpl)[0]
        self.assertEqual(files, expected_files)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号