

@test.create_stubs({
    cinder: ('volume_cgroup_create', 'volume_cgroup_list', 'volume_type_list', 'volume_type_list_with_qos_associations', 'availability_zone_list', 'extension_supported'),
})
def test_create_cgroup_exception(self):
    volume_types = self.cinder_volume_types.list()
    az = self.cinder_availability_zones.first().zoneName
    formData = {
        'volume_types': '1',
        'name': 'test CG',
        'description': 'test desc',
        'availability_zone': az,
    }
    cinder.volume_type_list(IsA(http.HttpRequest)).AndReturn(volume_types)
    cinder.volume_type_list_with_qos_associations(IsA(http.HttpRequest)).AndReturn(volume_types)
    cinder.availability_zone_list(IsA(http.HttpRequest)).AndReturn(self.cinder_availability_zones.list())
    cinder.extension_supported(IsA(http.HttpRequest), 'AvailabilityZones').AndReturn(True)
    cinder.volume_cgroup_list(IsA(http.HttpRequest)).AndReturn(self.cinder_consistencygroups.list())
    cinder.volume_cgroup_create(IsA(http.HttpRequest), formData['volume_types'], formData['name'], formData['description'], availability_zone=formData['availability_zone']).AndRaise(self.exceptions.cinder)
    self.mox.ReplayAll()
    url = reverse('horizon:project:volumes:cgroups:create')
    res = self.client.post(url, formData)
    self.assertRedirectsNoFollow(res, VOLUME_INDEX_URL)

dataset/ETHPy150Open openstack/horizon/openstack_dashboard/dashboards/project/volumes/cgroups/tests.py ConsistencyGroupTests.test_create_cgroup_exception/original