tests.py 文件源码

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

项目:mos-horizon 作者: Mirantis 项目源码 文件源码
def test_create_snapshot_button_attributes(self):
        limits = {'maxTotalSnapshots': 2}
        limits['totalSnapshotsUsed'] = 1
        volume = self.cinder_volumes.first()

        cinder.volume_get(IsA(http.HttpRequest), volume.id).AndReturn(volume)
        cinder.tenant_absolute_limits(IsA(http.HttpRequest)).AndReturn(limits)
        self.mox.ReplayAll()

        res_url = (VOLUME_INDEX_URL +
                   "?action=row_update&table=volumes&obj_id=" + volume.id)

        res = self.client.get(res_url, {},
                              HTTP_X_REQUESTED_WITH='XMLHttpRequest')

        snapshot_action = self._get_volume_row_action_from_ajax(
            res, 'snapshots', volume.id)
        self.assertEqual('horizon:project:volumes:volumes:create_snapshot',
                         snapshot_action.url)
        self.assertEqual(set(['ajax-modal']), set(snapshot_action.classes))
        self.assertEqual('Create Snapshot',
                         six.text_type(snapshot_action.verbose_name))
        self.assertEqual((('volume', 'volume:create_snapshot'),),
                         snapshot_action.policy_rules)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号