test_docker.py 文件源码

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

项目:fabricio 作者: renskiy 项目源码 文件源码
def test_options(self):
        cases = dict(
            default=dict(
                kwargs=dict(),
                expected={},
            ),
            custom=dict(
                kwargs=dict(options=dict(foo='bar')),
                expected={
                    'foo': 'bar',
                },
            ),
            collision=dict(
                kwargs=dict(options=dict(execute='execute')),
                expected={
                    'execute': 'execute',
                },
            ),
            override=dict(
                kwargs=dict(options=dict(env='custom_env')),
                expected={
                    'env': 'custom_env',
                },
            ),
            complex=dict(
                kwargs=dict(options=dict(
                    env='custom_env',
                    user=lambda service: 'user',
                    foo='foo',
                    bar=lambda service: 'bar',
                )),
                expected={
                    'env': 'custom_env',
                    'user': 'user',
                    'foo': 'foo',
                    'bar': 'bar',
                },
            ),
        )
        for case, data in cases.items():
            with self.subTest(case=case):
                container = TestContainer(**data['kwargs'])
                self.assertDictEqual(data['expected'], dict(container.options))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号