test_ec2.py 文件源码

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

项目:omni 作者: openstack 项目源码 文件源码
def test_add_ssh_keys_key_absent(self):
        fake_key = 'fake_key'
        fake_key_data = 'abcdefgh'
        with contextlib.nested(
            mock.patch.object(boto.ec2.EC2Connection, 'get_key_pair'),
            mock.patch.object(boto.ec2.EC2Connection, 'import_key_pair'),
        ) as (fake_get, fake_import):
            fake_get.return_value = False
            self.conn._add_ssh_keys(fake_key, fake_key_data)
            fake_get.assert_called_once_with(fake_key)
            fake_import.assert_called_once_with(fake_key, fake_key_data)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号