test_dcim.py 文件源码

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

项目:pynetbox 作者: digitalocean 项目源码 文件源码
def test_delete(self):
        with patch(
            'pynetbox.lib.query.requests.get',
            return_value=Response(fixture='{}/{}.json'.format(
                self.app,
                self.name[:-1]
            ))
        ) as mock, patch('pynetbox.lib.query.requests.delete') as delete:
            ret = getattr(nb, self.name).get(1)
            self.assertTrue(ret.delete())
            mock.assert_called_with(
                'http://localhost:8000/api/{}/{}/1/'.format(
                    self.app,
                    self.name.replace('_', '-')
                ),
                headers=HEADERS
            )
            delete.assert_called_with(
                'http://localhost:8000/api/{}/{}/1/'.format(
                    self.app,
                    self.name.replace('_', '-')
                ),
                headers=AUTH_HEADERS
            )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号