tests.py 文件源码

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

项目:ubuntu-standalone-builder 作者: OddBloke 项目源码 文件源码
def test_binary_hook_sequence_is_lower_than_030(
            self, write_cloud_config_in_memory, monkeypatch):
        # That's the lowest sequence of disks and we want to filter before that
        filter_template = '-- binary hook filter:{} --'
        hook_filter = 'some*glob'
        monkeypatch.setattr(
            generate_build_config,
            "BINARY_HOOK_FILTER_CONTENT", filter_template)
        output = write_cloud_config_in_memory(binary_hook_filter=hook_filter)
        cloud_config = yaml.load(output)
        expected_content = filter_template.format(hook_filter)
        for stanza in cloud_config['write_files']:
            content = base64.b64decode(stanza['content']).decode('utf-8')
            if content == expected_content:
                break
        else:
            pytest.fail('Binary hook filter not correctly included.')
        path = stanza['path'].rsplit('/')[-1]
        assert path < '030-some-file.binary'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号