tests.py 文件源码

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

项目:mos-horizon 作者: Mirantis 项目源码 文件源码
def test_associate_with_port_id(self):
        targets = [api.nova.FloatingIpTarget(s) for s in self.servers.list()]
        targets[0].port_id = '101'
        api.network.floating_ip_target_list(IsA(http.HttpRequest)) \
            .AndReturn(targets)
        api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \
            .AndReturn(self.floating_ips.list())
        self.mox.ReplayAll()

        base_url = reverse('%s:associate' % NAMESPACE)
        params = urlencode({'port_id': '101'})
        url = '?'.join([base_url, params])
        res = self.client.get(url)
        self.assertTemplateUsed(res, views.WorkflowView.template_name)
        workflow = res.context['workflow']
        choices = dict(workflow.steps[0].action.fields['ip_id'].choices)
        # Verify that our "associated" floating IP isn't in the choices list.
        self.assertTrue(self.floating_ips.first() not in choices)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号